Problem Of The Day
"AVL Tree Deletion"
Given an AVL tree and N values to be deleted from the tree. Write a function to delete a given value from the tree. All the N values which needs to be deleted are passed one by one as input data by driver code itself, you are asked to return the root of modified tree after deleting the value.
Example 1:
Tree =
4
/ \
2 6
/ \ / \
1 3 5 7
N = 4
Values to be deleted = {4,1,3,6}
Input: Value to be deleted = 4
Output:
5
/ \
2 6
/ \ \
1 3 7
Input: Value to be deleted = 1
Output:
5
/ \
2 6
\ \
3 7
Input: Value to be deleted = 3
Output:
5
/ \
2 6
\
7
Input: Value to be deleted = 6
Output:
5
/ \
2 7
Your Task:
You dont need to read input or print anything. Complete the function delelteNode() which takes the root of the tree and the value of the node to be deleted as input parameters and returns the root of the modified tree.
Note: The tree will be checked after each deletion.
If it violates the properties of balanced BST, an error message will be printed followed by the inorder traversal of the tree at that moment.
If instead all deletion are successful, inorder traversal of tree will be printed.
If every single node is deleted from tree, 'null' will be printed.
Expected Time Complexity: O(height of tree)
Expected Auxiliary Space: O(height of tree)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/avl-tree-deletion/1
"AVL Tree Deletion"
Given an AVL tree and N values to be deleted from the tree. Write a function to delete a given value from the tree. All the N values which needs to be deleted are passed one by one as input data by driver code itself, you are asked to return the root of modified tree after deleting the value.
Example 1:
Tree =
4
/ \
2 6
/ \ / \
1 3 5 7
N = 4
Values to be deleted = {4,1,3,6}
Input: Value to be deleted = 4
Output:
5
/ \
2 6
/ \ \
1 3 7
Input: Value to be deleted = 1
Output:
5
/ \
2 6
\ \
3 7
Input: Value to be deleted = 3
Output:
5
/ \
2 6
\
7
Input: Value to be deleted = 6
Output:
5
/ \
2 7
Your Task:
You dont need to read input or print anything. Complete the function delelteNode() which takes the root of the tree and the value of the node to be deleted as input parameters and returns the root of the modified tree.
Note: The tree will be checked after each deletion.
If it violates the properties of balanced BST, an error message will be printed followed by the inorder traversal of the tree at that moment.
If instead all deletion are successful, inorder traversal of tree will be printed.
If every single node is deleted from tree, 'null' will be printed.
Expected Time Complexity: O(height of tree)
Expected Auxiliary Space: O(height of tree)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/avl-tree-deletion/1
practice.geeksforgeeks.org
AVL Tree Deletion | Practice | GeeksforGeeks
Given an AVL tree and N values to be deleted from the tree. Write a function to delete a given value from the tree. All the N values which needs to be deleted are passed one by one as input data by driver code itself, you are asked to return the root
Must Learn!π‘
If youβre eager to become a versatile developer who can handle both the front-end and back-end aspects of web development, youβre in for an exciting ride.
From the widely-used JavaScript and Python to the cool and trendy Ruby and Go, weβll dive into the unique features and benefits of full-stack web development languages. By understanding each languageβs strengths, youβll be equipped to build powerful, interactive, and user-friendly web applications.
In this article, weβll introduce you to ten amazing programming languages that are essential for mastering full-stack web development.
Link- https://bit.ly/47UBk36
If youβre eager to become a versatile developer who can handle both the front-end and back-end aspects of web development, youβre in for an exciting ride.
From the widely-used JavaScript and Python to the cool and trendy Ruby and Go, weβll dive into the unique features and benefits of full-stack web development languages. By understanding each languageβs strengths, youβll be equipped to build powerful, interactive, and user-friendly web applications.
In this article, weβll introduce you to ten amazing programming languages that are essential for mastering full-stack web development.
Link- https://bit.ly/47UBk36
Write It Up results are out π₯³π₯³ Check them out now π€
Congratulations to each one of you on your tremendous efforts π€
Check here: https://www.geeksforgeeks.org/write-it-up-event-2023-share-your-experiences-on-geeksforgeeks/
Congratulations to each one of you on your tremendous efforts π€
Check here: https://www.geeksforgeeks.org/write-it-up-event-2023-share-your-experiences-on-geeksforgeeks/
Problem Of The Day
"Leftmost and rightmost nodes of binary tree"
Given a Binary Tree of size N, Print the corner nodes ie- the node at the leftmost and rightmost of each level.
Example 1:
Input :
1
/ \
2 3
/ \ / \
4 5 6 7
Output: 1 2 3 4 7
Explanation:
Corners at level 0: 1
Corners at level 1: 2 3
Corners at level 2: 4 7
Example 2:
Input:
10
/ \
20 30
/ \
40 60
Output: 10 20 30 40 60
Your Task:
You dont need to read input. Complete the function printCorner() which takes root node as input parameter and prints the corner nodes separated by spaces. The left corner should be printed before the right for each level starting from level 0.
Note: Don't print a new line after printing all the corner nodes.
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(number of nodes in a level)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/leftmost-and-rightmost-nodes-of-binary-tree/1
"Leftmost and rightmost nodes of binary tree"
Given a Binary Tree of size N, Print the corner nodes ie- the node at the leftmost and rightmost of each level.
Example 1:
Input :
1
/ \
2 3
/ \ / \
4 5 6 7
Output: 1 2 3 4 7
Explanation:
Corners at level 0: 1
Corners at level 1: 2 3
Corners at level 2: 4 7
Example 2:
Input:
10
/ \
20 30
/ \
40 60
Output: 10 20 30 40 60
Your Task:
You dont need to read input. Complete the function printCorner() which takes root node as input parameter and prints the corner nodes separated by spaces. The left corner should be printed before the right for each level starting from level 0.
Note: Don't print a new line after printing all the corner nodes.
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(number of nodes in a level)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/leftmost-and-rightmost-nodes-of-binary-tree/1
practice.geeksforgeeks.org
Leftmost and rightmost nodes of binary tree | Practice | GeeksforGeeks
Given a Binary Tree of size N, Print the corner nodes ie- the node at the leftmost and rightmost of each level.
Note: Don't print a new line after printing all the corner nodes.
Example 1:
Input :
1
/ \
2 3
/ \
Note: Don't print a new line after printing all the corner nodes.
Example 1:
Input :
1
/ \
2 3
/ \
π4π€―1
Must Learn!
API is a service created for user applications that request data or some functionality from servers.
To give specific access to our system to other applications which may be useful to them, developers create APIs and give them endpoints to interact and access the server data.
While working with JavaScript it is common to interact with APIs to fetch data or send requests to the server. In this article, we will see 4 ways to call APIs in JavaScript.
Link- https://bit.ly/47UgzEN
API is a service created for user applications that request data or some functionality from servers.
To give specific access to our system to other applications which may be useful to them, developers create APIs and give them endpoints to interact and access the server data.
While working with JavaScript it is common to interact with APIs to fetch data or send requests to the server. In this article, we will see 4 ways to call APIs in JavaScript.
Link- https://bit.ly/47UgzEN
π2
π¨ Job Alert π¨
Baliza.io is hiring for FullStack Developer- Django.
Location - Delhi, India
Experience - 2 - 6 Years
Apply by - Sep 29, 2023
Apply via the following link and share the opportunity with your friends - https://www.geeksforgeeks.org/jobs/baliza-fullstackdeveloper-django?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=fullstackdeveloperdjango
Baliza.io is hiring for FullStack Developer- Django.
Location - Delhi, India
Experience - 2 - 6 Years
Apply by - Sep 29, 2023
Apply via the following link and share the opportunity with your friends - https://www.geeksforgeeks.org/jobs/baliza-fullstackdeveloper-django?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=fullstackdeveloperdjango
π1
Problem Of The Day
"Leaf under budget"
Given a binary tree and a budget. Assume you are at the root of the tree(level 1), you need to maximise the count of leaf nodes you can visit in your budget if the cost of visiting a leaf node is equal to the level of that leaf node.
Example 1:
Input:
10
/ \
8 2
/ / \
3 3 6
\
4
and budget = 8
Output: 2
Explanation:
Cost For visiting Leaf Node 3: 3
Cost For visiting Leaf Node 4: 4
Cost For visiting Leaf Node 6: 3
In budget 8 one can visit Max 2 Leaf Nodes.
Example 2:
Input:
1
/ \
2 3
/ \ / \
4 5 6 7
and budget = 5
Output: 1
Explanation: We can only visit either node 4 or 5.
Your Task:
You don't need to read input or print anything. Your task is to complete the function getCount() which takes root node of the tree and a integer denoting the budget as input parameters and returns an integer denoting the count of visited leaf nodes of the tree.
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(N)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/leaf-under-budget/1
"Leaf under budget"
Given a binary tree and a budget. Assume you are at the root of the tree(level 1), you need to maximise the count of leaf nodes you can visit in your budget if the cost of visiting a leaf node is equal to the level of that leaf node.
Example 1:
Input:
10
/ \
8 2
/ / \
3 3 6
\
4
and budget = 8
Output: 2
Explanation:
Cost For visiting Leaf Node 3: 3
Cost For visiting Leaf Node 4: 4
Cost For visiting Leaf Node 6: 3
In budget 8 one can visit Max 2 Leaf Nodes.
Example 2:
Input:
1
/ \
2 3
/ \ / \
4 5 6 7
and budget = 5
Output: 1
Explanation: We can only visit either node 4 or 5.
Your Task:
You don't need to read input or print anything. Your task is to complete the function getCount() which takes root node of the tree and a integer denoting the budget as input parameters and returns an integer denoting the count of visited leaf nodes of the tree.
Expected Time Complexity: O(N)
Expected Auxiliary Space: O(N)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/leaf-under-budget/1
practice.geeksforgeeks.org
Leaf under budget | Practice | GeeksforGeeks
Given a binary tree and a budget. Assume you are at the root of the tree(level 1), you need to maximise the count of leaf nodes you can visit in your budget if the cost of visiting a leaf node is equal to the level of that leaf no
π4
Problem Of The Day
"Check if Tree is Isomorphic"
Given two Binary Trees. Check whether they are Isomorphic or not.
Note:
Two trees are called isomorphic if one can be obtained from another by a series of flips, i.e. by swapping left and right children of several nodes. Any number of nodes at any level can have their children swapped. Two empty trees are isomorphic.
For example, the following two trees are isomorphic with the following sub-trees flipped: 2 and 3, NULL and 6, 7 and 8.
ISomorphicTrees
Example 1:
Input:
T1 1 T2: 1
/ \ / \
2 3 3 2
/ /
4 4
Output: No
Example 2:
Input:
T1 1 T2: 1
/ \ / \
2 3 3 2
/ \
4 4
Output: Yes
Your Task:
You don't need to read input or print anything. Your task is to complete the function isomorphic() that takes the root nodes of both the Binary Trees as its input and returns True if the two trees are isomorphic. Else, it returns False. (The driver code will print Yes if the returned values are true, otherwise false.)
Expected Time Complexity: O(min(M, N)) where M and N are the sizes of the two trees.
Expected Auxiliary Space: O(min(H1, H2)) where H1 and H2 are the heights of the two trees.
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/check-if-tree-is-isomorphic/1
"Check if Tree is Isomorphic"
Given two Binary Trees. Check whether they are Isomorphic or not.
Note:
Two trees are called isomorphic if one can be obtained from another by a series of flips, i.e. by swapping left and right children of several nodes. Any number of nodes at any level can have their children swapped. Two empty trees are isomorphic.
For example, the following two trees are isomorphic with the following sub-trees flipped: 2 and 3, NULL and 6, 7 and 8.
ISomorphicTrees
Example 1:
Input:
T1 1 T2: 1
/ \ / \
2 3 3 2
/ /
4 4
Output: No
Example 2:
Input:
T1 1 T2: 1
/ \ / \
2 3 3 2
/ \
4 4
Output: Yes
Your Task:
You don't need to read input or print anything. Your task is to complete the function isomorphic() that takes the root nodes of both the Binary Trees as its input and returns True if the two trees are isomorphic. Else, it returns False. (The driver code will print Yes if the returned values are true, otherwise false.)
Expected Time Complexity: O(min(M, N)) where M and N are the sizes of the two trees.
Expected Auxiliary Space: O(min(H1, H2)) where H1 and H2 are the heights of the two trees.
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/check-if-tree-is-isomorphic/1
www.geeksforgeeks.org
Isomorphic Trees | Practice | GeeksforGeeks
Given the roots of two binary trees, determine whether the trees are isomorphic to each other. Return true if the two trees are isomorphic; otherwise, return false.
Note: Two trees are called isomorphic if one can be obtained from another by a s
Note: Two trees are called isomorphic if one can be obtained from another by a s
π1
π¨ Job Alert π¨
Turing is hiring for Front End Developer.
Location - Remote
Experience - Fresher
Apply by - Sep 09, 2023
Apply via the following link and share the opportunity with your friends - https://www.geeksforgeeks.org/jobs/turing-fed-sn?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=turingfedsen
Turing is hiring for Front End Developer.
Location - Remote
Experience - Fresher
Apply by - Sep 09, 2023
Apply via the following link and share the opportunity with your friends - https://www.geeksforgeeks.org/jobs/turing-fed-sn?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=turingfedsen
Problem Of The Day
"Replace O's with X's"
Given a matrix mat of size N x M where every element is either 'O' or 'X'. Replace all 'O' with 'X' that are surrounded by 'X'.
A 'O' (or a set of 'O') is considered to be surrounded by 'X' if there are 'X' at locations just below, just above, just left and just right of it.
Example 1:
Input:
n = 5, m = 4
mat = {{'X', 'X', 'X', 'X'},
{'X', 'O', 'X', 'X'},
{'X', 'O', 'O', 'X'},
{'X', 'O', 'X', 'X'},
{'X', 'X', 'O', 'O'}}
Output:
ans = {{'X', 'X', 'X', 'X'},
{'X', 'X', 'X', 'X'},
{'X', 'X', 'X', 'X'},
{'X', 'X', 'X', 'X'},
{'X', 'X', 'O', 'O'}}
Explanation:
Following the rule the above matrix is the resultant matrix.
Example 2:
Input:
n = 5, m = 4
mat = {{'X', 'O', 'X', 'X'},
{'X', 'O', 'X', 'X'},
{'X', 'O', 'O', 'X'},
{'X', 'O', 'X', 'X'},
{'X', 'X', 'O', 'O'}}
Output:
ans = {{'X', 'O', 'X', 'X'},
{'X', 'O', 'X', 'X'},
{'X', 'O', 'O', 'X'},
{'X', 'O', 'X', 'X'},
{'X', 'X', 'O', 'O'}}
Explanation:
Following the rule the above matrix is the resultant matrix.
Your Task:
You do not need to read input or print anything. Your task is to complete the function fill() which takes N, M and mat as input parameters ad returns a 2D array representing the resultant matrix.
Expected Time Complexity: O(n*m)
Expected Auxiliary Space: O(n*m)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/replace-os-with-xs0052/1
"Replace O's with X's"
Given a matrix mat of size N x M where every element is either 'O' or 'X'. Replace all 'O' with 'X' that are surrounded by 'X'.
A 'O' (or a set of 'O') is considered to be surrounded by 'X' if there are 'X' at locations just below, just above, just left and just right of it.
Example 1:
Input:
n = 5, m = 4
mat = {{'X', 'X', 'X', 'X'},
{'X', 'O', 'X', 'X'},
{'X', 'O', 'O', 'X'},
{'X', 'O', 'X', 'X'},
{'X', 'X', 'O', 'O'}}
Output:
ans = {{'X', 'X', 'X', 'X'},
{'X', 'X', 'X', 'X'},
{'X', 'X', 'X', 'X'},
{'X', 'X', 'X', 'X'},
{'X', 'X', 'O', 'O'}}
Explanation:
Following the rule the above matrix is the resultant matrix.
Example 2:
Input:
n = 5, m = 4
mat = {{'X', 'O', 'X', 'X'},
{'X', 'O', 'X', 'X'},
{'X', 'O', 'O', 'X'},
{'X', 'O', 'X', 'X'},
{'X', 'X', 'O', 'O'}}
Output:
ans = {{'X', 'O', 'X', 'X'},
{'X', 'O', 'X', 'X'},
{'X', 'O', 'O', 'X'},
{'X', 'O', 'X', 'X'},
{'X', 'X', 'O', 'O'}}
Explanation:
Following the rule the above matrix is the resultant matrix.
Your Task:
You do not need to read input or print anything. Your task is to complete the function fill() which takes N, M and mat as input parameters ad returns a 2D array representing the resultant matrix.
Expected Time Complexity: O(n*m)
Expected Auxiliary Space: O(n*m)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/replace-os-with-xs0052/1
practice.geeksforgeeks.org
Replace O's with X's | Practice | GeeksforGeeks
Given a matrix mat of size N x M where every element is either 'O' or 'X'. Replace all 'O' or a group of 'O' with 'X' that are surrounded by 'X'.
A 'O' (or a set of 'O') is considered to be surrounded by 'X' if there are 'X' at locations just below,
A 'O' (or a set of 'O') is considered to be surrounded by 'X' if there are 'X' at locations just below,
π5β€1
Must Learn!π‘
A proxy service provider is a company or organization that provides proxy services to individuals or businesses. In computer networking, a proxy acts as an intermediate server between a client (such as a userβs computer or device) and a destination server (such as a website or online service).
These providers maintain a network of proxy servers located in various geographic locations. These servers are set up to receive requests from clients and then forward them to the destination server on behalf of the client. This process helps hide the clientβs IP address and identity, offering enhanced anonymity and privacy.
Link- https://bit.ly/44DqrzG
A proxy service provider is a company or organization that provides proxy services to individuals or businesses. In computer networking, a proxy acts as an intermediate server between a client (such as a userβs computer or device) and a destination server (such as a website or online service).
These providers maintain a network of proxy servers located in various geographic locations. These servers are set up to receive requests from clients and then forward them to the destination server on behalf of the client. This process helps hide the clientβs IP address and identity, offering enhanced anonymity and privacy.
Link- https://bit.ly/44DqrzG
Problem Of The Day
"Print adjacency list"
Given an undirected graph with V nodes and E edges, create and return an adjacency list of the graph. 0-based indexing is followed everywhere.
Example 1:
Input:
V = 5, E = 7
edges = {(0,1),(0,4),(4,1),(4,3),(1,3),(1,2),(3,2)}
Output:
{{1,4},
{0,2,3,4},
{1,3},
{1,2,4},
{0,1,3}}
Explanation:
Node 0 is connected to 1 and 4.
Node 1 is connected to 0,2,3 and 4.
Node 2 is connected to 1 and 3.
Node 3 is connected to 1,2 and 4.
Node 4 is connected to 0,1 and 3.
Example 2:
Input:
V = 4, E = 3
edges = {(0,3),(0,2),(2,1)}
Output:
{{2,3}
{2},
{0,1}
{0}}
Explanation:
Node 0 is connected to 2 and 3.
Node 1 is only connected to 2.
Node 2 is connected to 0 and 1.
Node 3 is only connected to 0.
Your task:
You don't need to read input or print anything. Your task is to complete the function printGraph() which takes the integer V denoting the number of vertices and edges as input parameters and returns the list of list denoting the adjacency list.
Expected Time Complexity: O(V + E)
Expected Auxiliary Space: O(V + E)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/print-adjacency-list-1587115620/1
"Print adjacency list"
Given an undirected graph with V nodes and E edges, create and return an adjacency list of the graph. 0-based indexing is followed everywhere.
Example 1:
Input:
V = 5, E = 7
edges = {(0,1),(0,4),(4,1),(4,3),(1,3),(1,2),(3,2)}
Output:
{{1,4},
{0,2,3,4},
{1,3},
{1,2,4},
{0,1,3}}
Explanation:
Node 0 is connected to 1 and 4.
Node 1 is connected to 0,2,3 and 4.
Node 2 is connected to 1 and 3.
Node 3 is connected to 1,2 and 4.
Node 4 is connected to 0,1 and 3.
Example 2:
Input:
V = 4, E = 3
edges = {(0,3),(0,2),(2,1)}
Output:
{{2,3}
{2},
{0,1}
{0}}
Explanation:
Node 0 is connected to 2 and 3.
Node 1 is only connected to 2.
Node 2 is connected to 0 and 1.
Node 3 is only connected to 0.
Your task:
You don't need to read input or print anything. Your task is to complete the function printGraph() which takes the integer V denoting the number of vertices and edges as input parameters and returns the list of list denoting the adjacency list.
Expected Time Complexity: O(V + E)
Expected Auxiliary Space: O(V + E)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/print-adjacency-list-1587115620/1
practice.geeksforgeeks.org
Print adjacency list | Practice | GeeksforGeeks
Given an undirected graph with V nodes and E edges, create and return an adjacency list of the graph. 0-based indexing is followed everywhere.
Example 1:
Input:V = 5, E = 7edges = {(0,1),(0,4),(4,1),(4,3),(1,3),(1,2),(3,2)}
Output:
{
Example 1:
Input:V = 5, E = 7edges = {(0,1),(0,4),(4,1),(4,3),(1,3),(1,2),(3,2)}
Output:
{
β€2π1
Must Learn!π‘
The significance of internships and placements in the professional development of students is underscored by the knowledge and exposure they offer to an organization. The project work that the students receive as part of these programs is a vital aspect.
A good information technology project can set you apart from the competition and improve your chances of landing the employment opportunity of your dreams. Letβs talk about how to create quality tech projects for internships and job placement.
Link- https://bit.ly/3P753x6
The significance of internships and placements in the professional development of students is underscored by the knowledge and exposure they offer to an organization. The project work that the students receive as part of these programs is a vital aspect.
A good information technology project can set you apart from the competition and improve your chances of landing the employment opportunity of your dreams. Letβs talk about how to create quality tech projects for internships and job placement.
Link- https://bit.ly/3P753x6
π¨ Job Alert π¨
Avology Technologies is hiring for Backend Developer.
Location - Mohali
Experience - 1 - 2 Years
Apply by - Sep 23, 2023
Apply via the following link and share the opportunity with your friends - https://bit.ly/3r19LVe
Avology Technologies is hiring for Backend Developer.
Location - Mohali
Experience - 1 - 2 Years
Apply by - Sep 23, 2023
Apply via the following link and share the opportunity with your friends - https://bit.ly/3r19LVe
Problem Of The Day
"Mother Vertex"
Given a Directed Graph, find a Mother Vertex in the Graph (if present).
A Mother Vertex is a vertex through which we can reach all the other vertices of the Graph.
Example 1:
Input:
Output: 0
Explanation: According to the given edges, all
nodes can be reaced from nodes from 0, 1 and 2.
But, since 0 is minimum among 0,1 and 2, so 0
is the output.
Example 2:
Input:
Output: -1
Explanation: According to the given edges,
no vertices are there from where we can
reach all vertices. So, output is -1.
Your Task:
You don't need to read or print anything. Your task is to complete the function findMotherVertex() which takes V denoting the number of vertices and adjacency list as imput parameter and returns the verticex from through which we can traverse all other vertices of the graph. If there is more than one possible nodes then returns the node with minimum value.If not possible returns -1.
Expected Time Complexity: O(V + E)
Expected Space Compelxity: O(V)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/mother-vertex/1
"Mother Vertex"
Given a Directed Graph, find a Mother Vertex in the Graph (if present).
A Mother Vertex is a vertex through which we can reach all the other vertices of the Graph.
Example 1:
Input:
Output: 0
Explanation: According to the given edges, all
nodes can be reaced from nodes from 0, 1 and 2.
But, since 0 is minimum among 0,1 and 2, so 0
is the output.
Example 2:
Input:
Output: -1
Explanation: According to the given edges,
no vertices are there from where we can
reach all vertices. So, output is -1.
Your Task:
You don't need to read or print anything. Your task is to complete the function findMotherVertex() which takes V denoting the number of vertices and adjacency list as imput parameter and returns the verticex from through which we can traverse all other vertices of the graph. If there is more than one possible nodes then returns the node with minimum value.If not possible returns -1.
Expected Time Complexity: O(V + E)
Expected Space Compelxity: O(V)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/mother-vertex/1
practice.geeksforgeeks.org
Mother Vertex | Practice | GeeksforGeeks
Given a Directed Graph, find a Mother Vertex in the Graph (if present). A Mother Vertex is a vertex through which we can reach all the other vertices of the Graph.
Example 1:
Input:
Output: 0
Explanation: According to the given edges, all
nod
Example 1:
Input:
Output: 0
Explanation: According to the given edges, all
nod
π1
Must Learn!π‘
Smartphone apps are an integral part of our daily lives. They can be used to create connections, obtain information, or just have fun! And while creating a smartphone app is also fun, it requires a little more guidance, specifically in choosing the right programming language.
Thatβs why this article deals with the top programming languages required for Android App Development (Android because I like it!).
Also, if you want to learn how to create your own android application and explore the forefront in the world of app development, we at GeeksforGeeks have curated a special Android App Development Course for Beginners β Self Paced.
This course will help beginners accomplish their goals of developing Android Applications by using Java programming language.
Link- https://bit.ly/3EtCRzI
Smartphone apps are an integral part of our daily lives. They can be used to create connections, obtain information, or just have fun! And while creating a smartphone app is also fun, it requires a little more guidance, specifically in choosing the right programming language.
Thatβs why this article deals with the top programming languages required for Android App Development (Android because I like it!).
Also, if you want to learn how to create your own android application and explore the forefront in the world of app development, we at GeeksforGeeks have curated a special Android App Development Course for Beginners β Self Paced.
This course will help beginners accomplish their goals of developing Android Applications by using Java programming language.
Link- https://bit.ly/3EtCRzI
π2π₯°1
Problem Of The Day
"Minimum Multiplications to reach End"
Given start, end and an array arr of n numbers. At each step, start is multiplied with any number in the array and then mod operation with 100000 is done to get the new start.
Your task is to find the minimum steps in which end can be achieved starting from start. If it is not possible to reach end, then return -1.
Example 1:
Input:
arr[] = {2, 5, 7}
start = 3, end = 30
Output:
2
Explanation:
Step 1: 3*2 = 6 % 100000 = 6
Step 2: 6*5 = 30 % 100000 = 30
Example 2:
Input:
arr[] = {3, 4, 65}
start = 7, end = 66175
Output:
4
Explanation:
Step 1: 7*3 = 21 % 100000 = 21
Step 2: 21*3 = 63 % 100000 = 63
Step 3: 63*65 = 4095 % 100000 = 4095
Step 4: 4095*65 = 266175 % 100000 = 66175
Your Task:
You don't need to print or input anything. Complete the function minimumMultiplications() which takes an integer array arr, an integer start and an integer end as the input parameters and returns an integer, denoting the minumum steps to reach in which end can be achieved starting from start.
Expected Time Complexity: O(105)
Expected Space Complexity: O(105)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/minimum-multiplications-to-reach-end/1
"Minimum Multiplications to reach End"
Given start, end and an array arr of n numbers. At each step, start is multiplied with any number in the array and then mod operation with 100000 is done to get the new start.
Your task is to find the minimum steps in which end can be achieved starting from start. If it is not possible to reach end, then return -1.
Example 1:
Input:
arr[] = {2, 5, 7}
start = 3, end = 30
Output:
2
Explanation:
Step 1: 3*2 = 6 % 100000 = 6
Step 2: 6*5 = 30 % 100000 = 30
Example 2:
Input:
arr[] = {3, 4, 65}
start = 7, end = 66175
Output:
4
Explanation:
Step 1: 7*3 = 21 % 100000 = 21
Step 2: 21*3 = 63 % 100000 = 63
Step 3: 63*65 = 4095 % 100000 = 4095
Step 4: 4095*65 = 266175 % 100000 = 66175
Your Task:
You don't need to print or input anything. Complete the function minimumMultiplications() which takes an integer array arr, an integer start and an integer end as the input parameters and returns an integer, denoting the minumum steps to reach in which end can be achieved starting from start.
Expected Time Complexity: O(105)
Expected Space Complexity: O(105)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/minimum-multiplications-to-reach-end/1
practice.geeksforgeeks.org
Minimum Multiplications to reach End | Practice | GeeksforGeeks
Given start, end and an array arr of n numbers. At each step, start is multiplied with any number in the array and then mod operation with 100000 is done to get the new start.
Your task is to find the minimum steps in which end can be achieved
Your task is to find the minimum steps in which end can be achieved
π2
Problem Of The Day
"Binary Tree to BST"
Given a Binary Tree, convert it to Binary Search Tree in such a way that keeps the original structure of Binary Tree intact.
Example 1:
Input:
1
/ \
2 3
Output:
1 2 3
Explanation:
The converted BST will be
2
/ \
1 3
Example 2:
Input:
1
/ \
2 3
/
4
Output:
1 2 3 4
Explanation:
The converted BST will be
3
/ \
2 4
/
1
Your Task:
You don't need to read input or print anything. Your task is to complete the function binaryTreeToBST() which takes the root of the Binary tree as input and returns the root of the BST. The driver code will print inorder traversal of the converted BST.
Expected Time Complexity: O(NLogN).
Expected Auxiliary Space: O(N).
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/binary-tree-to-bst/1
"Binary Tree to BST"
Given a Binary Tree, convert it to Binary Search Tree in such a way that keeps the original structure of Binary Tree intact.
Example 1:
Input:
1
/ \
2 3
Output:
1 2 3
Explanation:
The converted BST will be
2
/ \
1 3
Example 2:
Input:
1
/ \
2 3
/
4
Output:
1 2 3 4
Explanation:
The converted BST will be
3
/ \
2 4
/
1
Your Task:
You don't need to read input or print anything. Your task is to complete the function binaryTreeToBST() which takes the root of the Binary tree as input and returns the root of the BST. The driver code will print inorder traversal of the converted BST.
Expected Time Complexity: O(NLogN).
Expected Auxiliary Space: O(N).
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/binary-tree-to-bst/1
www.geeksforgeeks.org
Binary Tree to BST | Practice | GeeksforGeeks
Given a Binary Tree, convert it to Binary Search Tree in such a way that keeps the original structure of Binary Tree intact. Examples:
Input:
Output: [1, 2, 3]Explanation:The converted BST will be
Input:
&n
Input:
Output: [1, 2, 3]Explanation:The converted BST will be
Input:
&n
Must Learn!π‘
For a very long time, human programmers have been the only ones allowed to compete in competitive coding, where they use their analytical thinking, coding knowledge, and problem-solving abilities to take on challenging tasks.
However, the intriguing question of whether ChatGPT can be used to resolve challenging coding problems has arisen with the development of advanced AI models like ChatGPT.
In this article, weβll examine ChatGPTβs potential as a tool for competitive coding competitions and talk about its advantages, drawbacks, and potential uses.
Link- https://bit.ly/3ZbDSGj
For a very long time, human programmers have been the only ones allowed to compete in competitive coding, where they use their analytical thinking, coding knowledge, and problem-solving abilities to take on challenging tasks.
However, the intriguing question of whether ChatGPT can be used to resolve challenging coding problems has arisen with the development of advanced AI models like ChatGPT.
In this article, weβll examine ChatGPTβs potential as a tool for competitive coding competitions and talk about its advantages, drawbacks, and potential uses.
Link- https://bit.ly/3ZbDSGj
π4β€2
Attention Please!π₯
Join us with Akhil Jain in YouTube on 9th September at 6PM onwards. Akhil will discuss the significance of automation in the fast-paced environment of software development.
He explains why choosing the right tool isn't just about its capabilities but also how well it integrates with your existing systems and meets your long-term needs.
Whether you're a beginner just starting out with automation testing or a seasoned tester looking to switch tools, this video has something for everyone.
Click here to join the live - https://bit.ly/3r4nkmK
Join us with Akhil Jain in YouTube on 9th September at 6PM onwards. Akhil will discuss the significance of automation in the fast-paced environment of software development.
He explains why choosing the right tool isn't just about its capabilities but also how well it integrates with your existing systems and meets your long-term needs.
Whether you're a beginner just starting out with automation testing or a seasoned tester looking to switch tools, this video has something for everyone.
Click here to join the live - https://bit.ly/3r4nkmK