GeeksforGeeks
17.4K subscribers
1.83K photos
34 videos
24 files
2.76K links
Official Hub βœ…

Your coding haven – where tech meets simplicity.

Discover:
πŸ˜‚ Coding Laughter
πŸ“˜ Curated Study Material
πŸ’Ž Exclusive Offers

Utilize every service we provide and make a promise to find better opportunities for yourself! #gfgkarlohojayega!
Download Telegram
Problem Of The Day
"Fixing Two swapped nodes of a BST"

Solve the problem to win points

Two of the nodes of a Binary Search Tree (BST) are swapped. Fix (or correct) the BST by swapping them back. Do not change the structure of the tree.
Note: It is guaranteed than the given input will form BST, except for 2 nodes that will be wrong.

Example 1:
Input:
10
/ \
5 8
/ \
2 20
Output: 1
Explanation:

Example 2:
Input:
11
/ \
3 17
\ /
4 10
Output: 1
Explanation:
By swapping nodes 11 and 10, the BST
can be fixed.

Your Task:
You don't need to take any input. Just complete the function correctBst() that takes root node as parameter. The function should return the root of corrected BST. BST will then be checked by driver code and 0 or 1 will be printed.

Expected Time Complexity : O(Number of nodes)
Expected Auxiliary Space : O(logN), N = number of nodes

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/6c4053871794c5e7a0817d7eaf88d71c4bb4c2bc/1

Powered by hirist.com
Must Learn!πŸ’‘
You might believe that coding careers are for math whizzes and equation nerds.

Don’t write off your chances of pursuing a profession in programming if that’s not you!

The truth is that anyone can become a coder, regardless of their expertise in mathematics.

This article talks about the topic in detail clearing all your doubts. Give it a read.

Link - https://www.geeksforgeeks.org/how-much-math-is-required-for-coding/
Problem Of The Day
"Count Cyclic Paths"

Solve the problem to win points

Given a triangular pyramid with its vertices marked as O, A, B and C and a number N, the task is to find the number of ways such that a person starting from the origin O initially, reaches back to the origin in N steps. In a single step, a person can go to any of its adjacent vertices.

Lightbox


Example 1:
Input:
N = 1
Output: 0
Explanation: The minimum length of
a cyclic path is 2.

Example 2:
Input:
N = 2
Output: 3
Explanation: The three paths are :
O-A-O, O-B-O, O-C-O

Your Task:
You don't need to read input or print anything. Your task is to complete the function countPaths() which takes an integer N as input parameter and returns the number of possible paths. Since the answer may be big, return it modulo (10^9+7).

Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1)

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/aa0000a5f710ce8d41366b714341eef644ec7b82/1

Powered by hirist.com
πŸ‘5
Must Learn!πŸ’‘
Java is a very successful and popular programming language.

It is very reliable and is widely used in our day-to-day lives, prominently seen in web or mobile applications.

There is much demand for Java these days and Java programmers are being recruited largely in the Information Technology sector.

This article talks about the amazing tips that every programmer should know to enhance their programming skills.

Link- https://practice.geeksforgeeks.org/jobs/VuNetSystems-Javadeveloper?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=javadeveloper
The details of Job-A-Thon 17 is out....πŸ˜ƒπŸ€Œ

Stride is hiring for Backend Developer.

Experience - 1-2 Years Location - Banglore

Register now - https://practice.geeksforgeeks.org/jobs/Stride-Inc-Backend-Developer-Job-A-Thon?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=jobathon
Problem Of The Day
"Fill the Matrix"

Solve the problem to win points

Given a matrix with dimensions N x M, entirely filled with zeroes except for one position at co-ordinates X and Y containing '1'. Find the minimum number of iterations in which the whole matrix can be filled with ones.
Note: In one iteration, '1' can be filled in the 4 neighbouring elements of a cell containing '1'.

Example 1:
Input:
N = 2, M = 3
X = 2, Y = 3
Output: 3

Explanation: 3 is the minimum possible
number of iterations in which the
matrix can be filled.

Example 2:
Input:
N = 1, M = 1
X = 1, Y = 1
Output: 0

Explanation: The whole matrix is
already filled with ones.

Your Task:
You don't need to read input or print anything. Your task is to complete the function minIterations() which takes the dimensions of the matrix N and M and the co-ordinates of the initial position of '1' ie X and Y as input parameters and returns the minimum number of iterations required to fill the matrix.


Expected Time Complexity: O(N*M)
Expected Auxiliary Space: O(1)

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/2145720aebf8ea0b07f76b17217b3353a0fbea7f/1

Powered by hirist.com
πŸ‘1
Connecting talent with opportunities, 'GeeksforGeeks Jobs Fair 2023' is here.πŸ˜ƒπŸ€Œ

A range of job opportunities with your dream organizations, this is the right move to give a boost to your career.πŸ’«

Start applying now - https://practice.geeksforgeeks.org/jobs?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=jobfair2023
❀2πŸ‘2
Problem Of The Day
"Connect Nodes at Same Level"

Solve the problem to win points

Given a binary tree, connect the nodes that are at the same level. The structure of the tree Node contains an addition nextRight pointer for this purpose.

Initially, all the nextRight pointers point to garbage values. Your function should set these pointers to point next right for each node.

10 10 ------> NULL
/ \ / \
3 5 => 3 ------> 5 --------> NULL
/ \ \ / \ \
4 1 2 4 --> 1 -----> 2 -------> NULL

Example 1:
Input:
3
/ \
1 2
Output:
3 1 2
1 3 2
Explanation:The connected tree is
3 ------> NULL
/ \
1---> 2 -----> NULL

Example 2:
Input:
10
/ \
20 30
/ \
40 60
Output:
10 20 30 40 60
40 20 60 10 30
Explanation:The connected tree is
10 ---> NULL
/ \
20---> 30 ---> NULL
/ \
40---> 60 ---> NULL
Your Task:
You don't have to read input or print anything. Complete the function connect() that takes the root of the tree as input parameter and connects the nodes that lie at the same level.

Note: The generated output will contain 2 lines. First line contains the level order traversal of the tree and second line contains the inorder traversal of the tree.


Expected Time Complexity: O(N)
Expected Auxiliary Space: O(N)

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/95423710beef46bd66f8dbb48c510b2c320dab05/1

Powered by hirist.com
πŸ‘3❀1πŸ”₯1
Must Learn!πŸ’‘
The burden of hiring multiple developers or coding experts has been just eliminated with the introduction of no-code tools.

So, Why has it become so popular in the software development industry?

No code development platforms have seen a huge surge in growth during the Covid-19 pandemic.

This article will introduce you with top 10 important No-Code Development platforms. Give it a read.

Link - https://www.geeksforgeeks.org/top-10-no-code-development-platforms/?utm_source=telegram[…]ketingteam_gfgmain&utm_campaign=nocodedevelopmentplatforms
Problem Of The Day
"Unique Paths in a Grid"

Solve the problem to win points

You are given a matrix grid of n x m size consisting of values 0 and 1. A value of 1 means that you can enter that cell and 0 implies that entry to that cell is not allowed.

You start at the upper-left corner of the grid (1, 1) and you have to reach the bottom-right corner (n, m) such that you can only move in the right or down direction from every cell.

Your task is to calculate the total number of ways of reaching the target modulo (109+7).
Note: The first (1, 1) and last cell (n, m) of the grid can also be 0

Example 1:
Input:
n = 3, m = 3
grid[][] = {{1, 1, 1};
{1, 0, 1};
{1, 1, 1}}
Output:
2
Explanation:
1 1 1
1 0 1
1 1 1
This is one possible path.
1 1 1
1 0 1
1 1 1
This is another possible path.

Example 2:
Input:
n = 1, m = 3
grid = {{1, 0, 1}}
Output :
0
Explanation:
There is no possible path to reach the end.

Your Task:
You don't need to read input or print anything. Your task is to complete the function uniquePaths() which takes 2 integers n, and m, and a matrix of size n*m as input and returns the number of unique paths from cell (1,1) to (n,m) modulo (109+7)


Expected Time Complexity: O(n*m)
Expected Auxiliary Space: O(n*m)

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/96161dfced02d544fc70c71d09b7a616fe726085/1

Powered by hirist.com
πŸ‘6
🚨Job Alert🚨
Centilytics is hiring for Java Developer.

Location - Noida and Bangalore
Experience - 2+ Years
Apply by - Mar 31, 2023

Apply via the following link and share the opportunity with your friends - https://practice.geeksforgeeks.org/jobs/centilytics-java-dev?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=javadev

πŸ‘‰Visit our jobs portal 'Get Hired With GeeksforGeeks' for more such job opportunities - https://practice.geeksforgeeks.org/jobs

πŸ‘‰Also, do not miss the chance to get endless opportunities at Jobs Fair 2023 - https://practice.geeksforgeeks.org/jobs?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=jobfair2023
Must Learn!πŸ’‘
Technology is evolving each and every day. Every day we’re witnessing new technology advancements which are due to a variety of factors, including advances in research and development, new products and services being launched, and changes in consumer preferences and needs.

One example of how technology is changing daily is the rapid advancement of artificial intelligence (AI) and machine learning.

So, what other trends are there and how are they helpful? This article talks about the top 15 ongoing technology trends. Give it a read.

Link- https://www.geeksforgeeks.org/top-technology-trends/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=toptechnologytrends
❀1
Problem Of The Day
"Shortest Path Using Atmost One Curved Edge"

Solve the problem to win points

Given an undirected connected graph of n vertices and list of m edges in a graph and for each pair of vertices that are connected by an edge.

There are two edges between them, one curved edge and one straight edge i.e. the tuple (x, y, w1, w2) means that between vertices x and y, there is a straight edge with weight w1 and a curved edge with weight w2.

You are given two vertices a and b and you have to go from a to b through a series of edges such that in the entire path you can use at most 1 curved edge. Your task is to find the shortest path from a to b satisfying the above condition. If there is no path from a to b, return -1.

Example 1:
Input:
n = 4, m = 4
a = 2, b = 4
edges = {{1, 2, 1, 4}, {1, 3, 2, 4},
{1, 4, 3, 1}, {2, 4, 6, 5}}
Output:
2

Explanation:
We can follow the path 2 -> 1 -> 4.
This gives a distance of 1+3 = 4 if we follow
all straight paths. But we can take the curved
path from 1 -> 4, which costs 1. This
will result in a cost of 1+1 = 2

Example 2:
Input:
n = 2, m = 1
a = 1, b = 2
edges = {{1, 2, 4, 1}}
Output :
1

Explanation:
Take the curved path from 1 to 2 which costs 1.

Your Task:
You don't need to read input or print anything. Your task is to complete the function shortestPath() which takes 4 integers n, m, a, and b, and a list of lists named edges of size m as input and returns the cost of shortest path from a to b.

Expected Time Complexity: O((m+n)log(n))
Expected Auxiliary Space: O(n+m)

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/e7d81a082cda6bd1e959d943197aa3bc21b88bdb/1

Powered by hirist.com
πŸ‘1
Must Learn!πŸ’‘
The goal of digital marketing is to connect with target audiences, build brand awareness, and drive sales and engagement through digital means.

Digital marketing tools are software or platforms used to support and enhance various aspects of a digital marketing campaign.

This article will introduce you with some amazing digital marketing tools to make your work more easier. Give it a read.

Link- https://www.geeksforgeeks.org/top-10-digital-marketing-tools/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=digitalmarketingtools
πŸ‘2
Problem Of The Day
"Valid Compressed String"

Solve the problem to win points

A special compression mechanism can arbitrarily delete 0 or more characters and replace them with the deleted character count.
Given two strings, S and T where S is a normal string and T is a compressed string, determine if the compressed string T is valid for the plaintext string S.


Example 1:

Input:
S = "GEEKSFORGEEKS"
T = "G7G3S"
Output:
1
Explanation:
We can clearly see that T is a valid
compressed string for S.

Example 2:

Input:
S = "DFS"
T = "D1D"
Output :
0
Explanation:
T is not a valid compressed string.

Your Task:
You don't need to read input or print anything. Your task is to complete the function checkCompressed() which takes 2 strings S and T as input parameters and returns integer 1 if T is a valid compression of S and 0 otherwise.


Expected Time Complexity: O(|T|)
Expected Auxiliary Space: O(1)

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/13eb74f1c80bc67d526a69b8276f6cad1b8c3401/1

Powered by hirist.com
πŸ‘1
🚨Job Alert🚨
Careers360 is hiring for Software Developer-Python.

Location - Gurgaon(Work from Office)
Experience - 4 to 6 Years
Apply by - Mar 31, 2023

Apply via the following link and share the opportunity with your friends - https://practice.geeksforgeeks.org/jobs/careers360-python-dev?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=pythondev

πŸ‘‰Visit our jobs portal 'Get Hired With GeeksforGeeks' for more such job opportunities - https://practice.geeksforgeeks.org/jobs

πŸ‘‰Also, do not miss the chance to get endless opportunities at Jobs Fair 2023 - https://practice.geeksforgeeks.org/jobs?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=jobfair2023
πŸ‘2
Problem Of The Day
"Number of Good Components"

Solve the problem to win points

Given an undirected graph with V vertices(numbered from 1 to V) and E edges. Find the number of good components in the graph.

A component of the graph is good if and only if the component is a fully connected component.

Note: A fully connected component is a subgraph of a given graph such that there's an edge between every pair of vertices in a component, the given graph can be a disconnected graph. Consider the adjacency list from index 1.

Example 1:
Input:

Output: 1
Explanation: We can see that there is only one
component in the graph and in this component
there is a edge between any two vertces.

Example 2:
Input:

Output: 2
Explanation: We can see that there are 3 components
in the graph. For 1-2-7 there is no edge between
1 to 7, so it is not a fully connected component.
Rest 2 are individually fully connected component.

Your Task:
You don't need to read input or print anything. Your task is to complete the function findNumberOfGoodComponent() which takes an integer V and an adjacency list adj as input parameters and returns an integer denoting the number of good components.

Expected Time Complexity: O(V+E)
Expected Auxiliary Space: O(depth of the graph)

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/1a4b617b70f0142a5c2b454e6fbe1b9a69ce7861/1

Powered by hirist.com
πŸ‘2
Must Learn!πŸ’‘
A network security key is a set of characters that authorize you to access a network. This key gives a secure connection between the serving network and the requesting client.

In other words, thr security key is another name for the Wi-Fi password. So, how will you find it?

This article talks about Network Security Key and the ways to find it in detail. Give it a read.

Link- https://www.geeksforgeeks.org/what-is-network-security-key-how-to-find-it/
πŸ‘2
Problem Of The Day
"Reverse both parts"

Solve the problem to win points

Given a linked list and a number k. You have to reverse first part of linked list with k nodes and the second part with n-k nodes.

Example 1:
Input: 1 -> 2 -> 3 -> 4 -> 5
k = 2
Output: 2 -> 1 -> 5 -> 4 -> 3
Explanation: As k = 2 , so the first part 2
nodes: 1 -> 2 and the second part with 3 nodes:
3 -> 4 -> 5. Now after reversing the first part:
2 -> 1 and the second part: 5 -> 4 -> 3.
So the output is: 2 -> 1 -> 5 -> 4 -> 3

Example 2:
Input: 1 -> 2 -> 4 -> 3
k = 3
Output: 4 -> 2 -> 1 -> 3
Explanation: As k = 3 , so the first part
3 nodes: 4 -> 2 -> 1 and the second part
with 1 nodes: 3. Now after reversing the
first part: 1 -> 2 -> 4 and the
second part: 3. So the output is: 1 -> 2 -> 4 -> 3

Your Task:
You don't need to read input or print anything. Your task is to complete the function reverse() which takes head node of the linked list and a integer k as input parameters and returns head node of the linked list after reversing both parts.


Constraints:
1 <= N <= 105
1 <= k < N

Expected Time Complexity: O(N)
Expected Space Complexity: O(1)

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/bae68b4d6a2a77fb6bd459cf7447240919ebfbf5/1

Powered by hirist.com
Must Learn!πŸ’‘
Many emails are lost in the receiver’s mailbox. Some are ignored or deleted, and some are responded to with a curt β€œunsubscribe.”

So, how can email campaigns achieve the best results?.

This article talks about email marketing trend that will on point, in detail. Give it a read.

Link- https://www.geeksforgeeks.org/top-10-email-marketing-trends/
πŸ‘1