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
"Minimum BST Sum Subtree"

Solve the problem to win points

Given a binary tree and a target, find the length of minimum sub-tree with the given sum equal to target which is also a binary search tree.

Example 1:
Input:
13
/ \
5 23
/ \ / \
N 17 N N
/
16
Target: 38
Output: 3
Explanation: 5,17,16 is the smallest subtree
with length 3.


Example 2:
Input:
7
/ \
N 23
/ \
10 23
/ \ / \
N 17 N N
Target: 73
Output: -1
Explanation: No subtree is bst for the given target.

Your Task:
You don't need to read input or print anything. Your task is to complete the function minSubtreeSumBST() which takes the tree root and target as input parameters and returns length of largest subtree having sum equal to the target which is also a binary search tree.

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

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

Powered by hirist.com
❀2
It's easy to search and apply for your dream job. That's how Aditi got her break!!!🎊

Link- https://practice.geeksforgeeks.org/jobs
πŸ‘Ž1
Internships can help you stand out and build an image as a prospective employee.

But how do you fetch a good internship- one in your dream company?

Look no further! This article will sweep you through all the details.

Link- https://www.geeksforgeeks.org/ways-to-find-and-get-your-dream-internship/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=ways-to-find-and-get-your-dream-internship
πŸ‘Ž4❀1
Future is bright ahead!πŸ˜ƒπŸ€Œ

Take up the challenge and make the best move for your career. Because we are here with exciting opportunities at Job-A-Thon 19.πŸ•Ί

Embrace your future by working with your dream organizations.πŸ™Œβœ¨

Register Here: https://practice.geeksforgeeks.org/jobs/EsteplogicITSolutionsPvtLtd-PHPintern-Job-A-Thon19
Media is too big
VIEW IN TELEGRAM
Work hard in silence, let your badges make the noise! πŸ…πŸ™Œ

Introducing GeeksforGeeks Author Badges πŸ…πŸ…
Your contribution as a GfG author will now be recognised on the platform! So get ready to brag your badges all over your resumes and your profiles!

Visit your GFG Auth profile right now and check out your badge.

Use #GfGAuthorBadge while sharing your posts and let's create a community of Ace Authors! 🀘🀘

Login & Visit your GFG Auth profile right now and check out your badge: https://auth.geeksforgeeks.org/
Problem Of The Day
"Wifi Range"

Solve the problem to win points

There are N rooms in a straight line in Geekland State University's hostel, you are given a binary string S of length N where S[i] = '1' represents that there is a wifi in ith room or S[i] = '0' represents no wifi. Each wifi has range X i.e. if there is a wifi in ith room then its range will go upto X more rooms on its left as well as right. You have to find whether students in all rooms can use wifi.

Example 1:
Input:
N = 3, X = 0
S = "010"
Output:
0
Explanation:
Since the range(X)=0, So Wifi is only
accessible in second room & 1st & 2nd
room have no wifi.

Example 2:
Input:
N = 5, X = 1
S = "10010"
Output:
1
Explanation:
Index 0 : Wifi is available
Index 1 : Since range of 0th Index is 1
so, here wifi will be available.
Index 2 : Since range of 3rd Index is 1
so, here also wifi available.
Index 3 : Wifi is available
Index 4 : here range of 3rd Index is available.
So all the rooms have wifi, so return true.

Your Task:
You don't need to read input or print anything. Your task is to complete the function wifiRange( ) which takes integer N, string S and integer X as input parameters and returns true if students in all rooms can use wifi or false otherwise.

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

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

Powered by hirist.com
πŸ‘2
We bet you don't wanna miss this opportunity!πŸ˜ƒπŸ€Œ

Take up the challenge and make the best move for your career. Because we are here with exciting opportunities at Job-A-Thon 19.πŸ•Ί

Embrace your future by working with your dream organizations.πŸ™Œβœ¨

Register Here: https://practice.geeksforgeeks.org/jobs/SurveySparrow-Job-a-thon-19
This media is not supported in your browser
VIEW IN TELEGRAM
Must Learn!πŸ’‘
In the software development industry, ChatGPT has the potential to revolutionize the way we think about and approach software development.

One of the most significant ways that ChatGPT is transforming the software development process is by making coding more intuitive.

So, how ChatGPT is transforming the software development process? This article will give the answer. Give it a read.

Link- https://www.geeksforgeeks.org/how-chatgpt-is-transforming-the-software-development-process/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=chatgpt-is-transforming-the-software-development-process
Problem Of The Day
"Bheem Wants Ladoos"

Solve the problem to win points

Chhota Bheem wants to eat the maximum number of ladoos in Dholakpur on Independence Day. The houses in Dholakpur are arranged in the form of a binary tree and have ladoos the same as their house number. Chhota Bheem is standing at his home initially.

Find the maximum ladoos he can eat if he can go to houses within a maximum distance k from his house. The number of ladoos at his home should also be included in the sum.

Note: Every house has distinct ladoos in it.

Example 1:
Input:
1
/ \
2 9
/ / \
4 5 7
/ \ / \
8 19 20 11
/ / \
30 40 50
home = 9, K = 1
Output:
22
Explanation:
Initially Bheem at 9, so sum = 9
In 2nd move he went to 5, sum=9+5=14
In 3rd move he went to 7, sum=14+7=21
In 4th move he went to 1, sum=21+1=22
So within K distance bheem can get 22 ladoos.

Example 2:
Input:
1
/ \
2 9
/ / \
4 5 7
/ \ / \
8 19 20 11
/ / \
30 40 50
home = 40, K = 2
Output:
113
Explanation:
Initially Bheem at 40, so sum = 40
In 2nd move he went to 19, sum=40+19=59
In 3rd move he went to 4, sum=59+4=63
In 4th move he went to 50, sum=63+50=113
So within K distance bheem can get 113 ladoos.

Your Task:
You don't need to read input or print anything. Complete the function ladoos() which takes the root of the tree, home, and K as input parameters and returns the maximum number of ladoos he can eat.

Expected Time Complexity: O(N), where N is no. of nodes
Expected Space Complexity: O(1)

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

Powered by hirist.com
πŸ‘3
This opportunity is for you!πŸ˜ƒπŸ€Œ

Take up the challenge and make the best move for your career. Because we are here with exciting opportunities at Job-A-Thon 19.πŸ•Ί

Embrace your future by working with your dream organizations.πŸ™Œβœ¨

Register Here: https://practice.geeksforgeeks.org/jobs/OrientalOutsourcing_SoftwareTrainee_Jobathon19
❀1πŸ‘1
Must Learn!πŸ’‘
Chances are you suffer from worker’s fatigue and take some measures to change, which is important if you want to grow in your career further.

That is the main point of concern in this article, and you will learn different techniques to overcome your career stagnation.

How will you handle the situation? This article will guide you. Give it a read.

Link- https://www.geeksforgeeks.org/tips-strategies-to-overcome-stagnation-in-career/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=strategiestoovercomestagnationincareer
Problem Of The Day
"Prefix Suffix String"

Solve the problem to win points

Given two Lists of strings s1 and s2, you have to count the number of strings in s2 which is either a suffix or prefix of at least one string of s1.

Example 1:
Input:
s1 = ["cat", "catanddog", "lion"]
s2 = ["cat", "dog", "rat"]
Output:
2
Explanation:
String "cat" of s2 is prefix of "catanddog"
& string "dog" of s2 is suffix of "catanddog"

Example 2:
Input:
s1 = ["jrjiml", "tchetn", "ucrhye", "ynayhy",
"cuhffd", "cvgpoiu", "znyadv"]
s2 = ["jr", "ml", "cvgpoi", "gpoiu", "wnmkmluc",
"geheqe", "uglxagyl", "uyxdroj"]
Output:
4
Explanation:
String "jr" of s2 is prefix of "jrjiml",
"ml" of s2 is suffix of "jrjiml",
"cvgpoi" of s2 is prefix of "cvgpoiu" &
"gpoiu" of s2 is suffix of "cvgpoiu"

Your Task:
You don't need to read input or print anything. Your task is to complete the function prefixSuffixString(), which takes 2 strings s1 and s2 as input and returns an integer value as the number of strings in s2 which is a prefix or suffix in s1.

Expected Time Complexity: O(max(len(s1) , len(s2) ))
Expected Space Complexity: O(1)

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/5be83263c7f2cb866c60b23b73bb38f88de2461c/1,

Powered by hirist.com
πŸ‘2πŸ”₯1
Eid-al-Fitr Mubarak, Geeks! πŸŒ™πŸ’š
❀27πŸ‘3πŸ₯°2πŸ‘Ž1
What indicates an author’s growth?
Anonymous Poll
46%
Creativity Level
35%
Number of Readers
5%
Awards
14%
Published Work
GeeksforGeeks
What indicates an author’s growth?
With this, we are glad to inform you that the author badges are live for all the authors who are contributing information for lakhs of readers and sharing knowledge.

Write and get your badge now and flaunt your success using #GFGAuthorBadges on social media.πŸ™Œβœ¨
πŸ‘3
Problem Of The Day
"Smaller Sum"

Solve the problem to win points

You are given an array arr of n integers. For each index i, you have to find the sum of all integers present in the array with a value less than arr[i].

Example 1:
Input:
n = 3
arr = {1, 2, 3}
Output:
0 1 3
Explanation:
For 1, there are no elements lesser than itself.
For 2, only 1 is lesser than 2.
And for 3, 1 and 2 are lesser than 3, so the sum is 3.

Example 2:
Input:
n = 2
arr = {4, 4}
Output:
0 0
Explanation:
For 4, there are no elements lesser than itself.
For 4, there are no elements lesser than itself.
There are no smaller elements than 4.

Your Task:
You don't need to read input or print anything. Your task is to complete the function smallerSum() which takes an integer n and an array arr and returns an array of length n , the answer for every index.

Expected Time Complexity:O(n log n)
Expected Space Complexity:O(n)

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/5877fde1c8e1029658845cd4bc94066ac1d4b09b/1,

Powered by hirist.com
πŸ‘1
Problem Of The Day
"Minimum Number"

Solve the problem to win points

You are given an array arr of n elements. In one operation you can pick two indices i and j, such that arr[i] >= arr[j] and replace the value of arr[i] with (arr[i] - arr[j]). You have to minimize the values of the array after performing any number of such operations.

Example 1:
Input:
n = 3
arr = {3,2,4}
Output:
1
Explanation:
1st Operation : We can pick 4 & 3, subtract 4-3 => {3,2,1}
2nd Opeartion : We can pick 3 & 2, subtarct 3-2 => {1,2,1}
3rd Operation : We can pick 1 & 2, subtract 2-1 => {1,1,1}
4th Opeartion : We can pick 1 & 1, subtract 1-1 => {1,0,1}
5th Operation : We can pick 1 & 1, subtract 1-1 => {0,0,1}
After this no operation can be performned, so maximum no is left in the array is 1, so the ans is 1.

Example 2
Input:
n = 2
arr = {2,4}
Output:
2
Explanation:
1st Operation : We can pick 4 & 2, subtract 4-2 => {2,2}
2nd Operation : We can pick 2 & 2, subtract 2-2 => {0,2}
After this no operation can be performned, so maximum no is left in the array is 2, so the ans is 2.

Your Task:
You don't need to read input or print anything. Your task is to complete the function minimumNumber() which takes an integer n and an array arr, as input parameters and returns the maximum number which is minimized after performing operations.

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

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/7d62c8606123a199720c9b6885249dc9ac651bb7/1,

Powered by hirist.com
πŸ‘2
Must Learn!πŸ’‘

The number of cyber crimes has been increasing every year and the need for cybersecurity is in huge demand for the past few years.

But, to begin your journey in the CyberSecurity domain, you must understand the grounds of cybersecurity and the skills to enhance it with the current tools and technologies.

This article will introduce you with cyber security specialist skills. Give it a read.

Link- https://www.geeksforgeeks.org/top-cyber-security-specialist-skills/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=topcybersecurityspecialistskills
πŸ‘1
Problem Of The Day
"Nearest smaller tower"

Solve the problem to win points

Given an array where each element (arr[i]) represents the height of the tower. Find for each tower, the nearest possible tower that is shorter than it. You can look left or right on both sides.
Note :

If two smaller towers are at the same distance, pick the smallest tower.

If two towers have the same height then we choose the one with a smaller index.

Example 1:
Input:
arr[] = {1,3,2}
Output:
{-1,0,0}
Explanation:
For 0th Index : no tower is smallest, so -1.
For 1st Index : For 3, here 1 & 2 both are
small & at a same distance, so we will pick 1,
beacuse it has smallest value, so 0(Index)
For 2nd Index : here 1 is smaller, so 0(Index)
So the final output will be which consistes
Indexes are {-1,0,0}.

Example 2:
Input:
arr[] = {4,8,3,5,3}
Output:
{2,2,-1,2,-1}

Explanation:
For 0th Index : here 3 is the smaller, so 2(Index)
For 1st Index : For 8, here 4 & 3 both are
small & at a same distance, so we will pick 3, so 2(Index)
For 2nd Index : no tower is smallest, so -1.
For 3rd Index : For 5, here 3 & 3 both are
small & at a same distance, so we will pick
3(2nd Index) because it smaller Index, so 2(Index)
For 4th Index : no tower is smallest, so -1.
So the final output will be which consistes
Indexes are {2,2,-1,2,-1}.

Your Task:
You don't need to read input or print anything. Your task is to complete the function nearestSmallerTower() which takes an array of heights of the towers as input parameter and returns an array of indexes of the nearest smaller tower. If there is no smaller tower on both sides then return -1 for that tower.

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

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

Powered by hirist.com
πŸ‘2
Must Learn!πŸ’‘
The number of cyber crimes has been increasing every year and the need for cybersecurity is in huge demand for the past few years.

To begin your journey in the CyberSecurity domain, you must understand the grounds of cybersecurity and the skills to enhance it with the current tools and technologies.

This article will introduce you with cyber security specialist skills. Give it a read.

Link- https://www.geeksforgeeks.org/top-cyber-security-specialist-skills/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=topcybersecurityspecialistskills
❀1