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
102 students have already been placed in the first week of Job Fair 2023.🕺🎊

They have started their journey towards success. What are you waiting for?🤔

Go and start applying now!😃🙌

Apply here: https://www.geeksforgeeks.org/jobs?tab=studentjobfair
👍1
Problem Of The Day
"Cake Distribution Problem"

Solve the problem to win points

Geek is organizing a birthday party, so his friends brought a cake for him. The cake consists of N chunks, whose individual sweetness is represented by the sweetness array. Now at the time of distribution, Geek cuts the cake into K + 1 pieces to distribute among his K friends. One piece he took for himself. Each piece consists of some consecutive chunks. He is very kind, so he left the piece with minimum sweetness for him.

You need to find the maximum sweetness that the Geek can get if he distributes the cake optimally.

Example 1:
Input:
N = 6, K = 2
sweetness[] = {6, 3, 2, 8, 7, 5}
Output:
9
Explanation:
Geek can divide the cake to [6, 3], [2, 8], [7, 5]
with sweetness level 9, 10 and 12 respectively.

Example 2:
Input:
N = 7, K = 3
sweetness[] = {1, 2, 4, 7, 3, 6, 9}
Output:
7
Explanation:
Geek can divide the cake to [1, 2, 4], [7], [3, 6], [9]
with sweetness level 7, 7, 9 and 9 respectively.

Your Task:
You need to complete the maxSweetness() function which takes an integer array of sweetness, an integer N and an integer K as the input parameters and returns an integer denoting the maximum sweetness that the Geek can get.

Expected Time Complexity: O(NlogM), where M is the sum of elements in the array.
Expected Space Complexity: O(1)

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

Powered by hirist.com
👍2❤1
It's happening!!!!😃🙌 Numbers speak...are you listening? 🤔

102 students have already been placed in the first week to work with their dream organizations.

Making your way towards success easier with Job Fair 2023 - Exclusively for students. 🕺🎊

Apply here: https://www.geeksforgeeks.org/jobs?tab=studentjobfair
Must Learn!💡
Considerably, the major reason which makes an application function properly is the invention of microservice architecture.

Using microservice architecture in your application helps you to build it in a more effective and efficient manner.

In this article, we are going to discuss 5 major challenges you could face in the microservice architecture. Give it a read.

Link- https://www.geeksforgeeks.org/challenges-and-solutions-of-microservices-architecture/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=challengesandsolutionsofmicroservicesarchitecture
Problem Of The Day
"Make Palindrome"

Solve the problem to win points

You are given an array of strings arr of size n. You have to find out if it is possible to make a palindromic string by concatenating the strings in any order. Provided that all the strings given in the array are of equal length.

Example 1:
Input:
n = 4
arr = {"djfh", "gadt", "hfjd", "tdag"}
Output:
YES
Explanation:
You can make the string "djfhgadttdaghfjd", by concatenating the given strings which is a palindrome.

Example 2:
Input:
n = 3
arr = {"jhjdf", "sftas", "fgsdf"}
Output:
NO
Explanation:
You can't make a palindromic string with this strings.

Your Task:
You don't need to read input or print anything. Your task is to complete the function makePalindrome() which takes an integer n and an array of strings arr respectively and returns true or false.

Expected Time Complexity: O(n * len(arr[i]))
Expected Space Complexity: O(n * len(arr[i]))

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

Powered by hirist.com
👍1
Must Learn!💡
In the world of technology, everyday there is something new to know about. The new name in room is ChaosGPT.

Well AI is helpful for us now. But, what if we tell you that ChaosGPT wants to destroy humans?

How is it possible and what makes ChaosGPT do so? This will answer all your questions. Give it a read.

Link- https://www.geeksforgeeks.org/what-is-chaosgpt-and-why-it-wants-to-destroy-humanity/?ut[…]ram&utm_medium=marketingteam_gfgmain&utm_campaign=chaosgpt
This media is not supported in your browser
VIEW IN TELEGRAM
Worried about campus placements? Well, you no longer need to.😎

This Job Fair is exclusively for students like you.😃🤌

So, don't wait and start applying now- https://www.geeksforgeeks.org/jobs?tab=studentjobfair
👍2
Problem Of The Day
"Max Coins"

Solve the problem to win points

Your are given an 2D integer array ranges whose length is n where ranges[i]=[starti,endi,coinsi] means all integers from starti to endi inclusive starti and endi are present and we get coinsi amount of coins when we select this ith range . You can select atmost two intervals so as to collect maximum coins but if u select two ranges than those two ranges should not intersect or overlapp than can touch each other.

Note : You can select at max 2 ranges and they should not intersect with each other but they can touch themselves.

Example 1:
Input :
n=3
ranges={{1,3,4},{2,3,5},{3,4,2}}
Output: 7
Explanation:
We can see that we can take 2nd and
3rd ranges as they are not intersecting
(only touching) we get maximum Coins by
taking these ranges(5+2=7).

Example 2:
Input :
n=5
ranges={{1,3,4},{2,3,5},{3,4,2},{5,8,9},{2,8,10}}
Output: 14
Explanation:
We can see that we can take 2nd and
4th ranges as they are not intersecting
we get maximum Coins(5+9=14) by taking
these ranges.

Your Task:
You don't need to read input or print anything. Your task is to complete the function maxCoins() which takes an integer n(length of ranges) and integer 2D integer array ranges and you have to return the maximum number of coins which you can get after selecting atmost two ranges which are not intersecting.

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

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

Powered by hirist.com
👍1
Must Learn!💡
Artificial Intelligence is now an integral part of constantly growing scientific world.

Human intelligence performed by machines is referred to as Artificial Intelligence.

Well, there is a lot that has learned about it and via this article, we will get to know about various books about Artificial Intelligence, especially for beginners.

Link- https://www.geeksforgeeks.org/best-artificial-intelligence-books/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=artificialintelligencebooks
👍3
Problem Of The Day
"Good Subtrees"

Solve the problem to win points

You are given a root node of a binary Tree and each node of the binary tree is assigned a value and you are also given an integer k and you have to return the count of Good subtrees of this binary Tree . Good subtree is a subtree such that the number of distinct values in this subtree is less than or equal to k.

Note: Subtree of a node consists of that node and all nodes of the subtrees of left and right child of that node if they exist .

Example 1:
Input:

k=2
Output: 4
Explanation:
We can see all leaves 3,4,5 form good subtrees as number of distinct values in subtrees is 1 which is less than k which is given as 2,now subtree which starts at 2 and has 3 as left node is also a good subtree because the count of distinct values is 2 which is equal to k so overall 4 good subtrees.

Example 2:
Input:

k=1
Output: 4
Explanation:
we can see all leaves 2,2 form good subtrees as number of distinct values in subtrees is 1 which is equal to k which is given as 1, now both subtrees which starts at 2 and has 2 as child also forms a good subtree because count of distinct values is 1 which is equal to k so overall 4 good subtrees.

Your Task:
You don't need to read input or print anything. Your task is to complete the function goodSubtrees() which takes root of binary tree and an integer k respectively and you have to return the count of good subtrees .

Expected Time Complexity: O(n*k)
Expected Space Complexity: O(n+n*k), where n is the size of recursion stack.

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

Powered by hirist.com
👍3
Must Learn!💡
Over the past few years, artificial intelligence (AI) and automation in the workforce have given birth to the phobia of layoffs across industries.

The arrival of AI-driven chatbot ChatGPT at a time when companies are looking to cut their costs to mitigate the impact of unfavoured macroeconomic conditions has increased the fears of layoffs in the workforce across the world.

This article will help you explore how ChatGPT has impacted the global job market. Give it a read.

Link- https://www.geeksforgeeks.org/chatgpt-impact-on-the-global-job-market/?utm_source=teleg[…]etingteam_gfgmain&utm_campaign=chatgptimpactonglobalmarket
👍1
Problem Of The Day
"Another Coin Change Problem"

Solve the problem to win points

Given three integers n, k, target, and an array of coins of size n. Find if it is possible to make a change of target cents by using an infinite supply of each coin but the total number of coins used must be exactly equal to k.

Example 1:
Input:
n = 5, k = 3, target = 11
coins = {1, 10, 5, 8, 6}

Output:
1

Explanation:
2 coins of 5 and 1 coins of 1 can be used
to make change of 11 i.e. 11 => 5+5+1.

Example 2:
Input:
n = 3, k = 5, target = 25
coins = {7, 2, 4}

Output:
1

Explanation:
3 coins 7, 2 coins of 2 can be used to
make change of 25 i.e. 25 => 7+7+7+2+2.

Your Task:
This is a function problem. You only need to complete the function makeChanges() that 3 integers n, k, target, and an array coins as parameters and return True or False.

Expected Time Complexity: O(n*k*target)
Expected Space Complexity: O(k*target)

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

Powered by hirist.com
👍1
Problem Of The Day
"String Mirror"

Solve the problem to win points

You are given a string str of length n. You want to choose a non-zero integer k (k<=n), such that you can perform the following operation:

Take the prefix of the string of length k and append the reverse of it to itself.
Your task is to find the lexicographically smallest string you can get.

Example 1:
Input:
str = "bvdfndkn"
Output:
bb
Explanation:
"bb" is the lexicographically smallest string you can get. If you choose k>1 the order of the resulting string will increase.

Example 2:
Input:
str = "casd"
Output:
caac
Explanation:
"caac" is the lexicographically smallest string you can get.

Your Task:
You don't need to read input or print anything. Your task is to complete the function stringMirror() which takes a String str as input, and returns the lexicographically smallest string.

Expected Time Complexity: O(|str|)
Expected Space Complexity: O(|str|)

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

Powered by hirist.com
👍1🔥1
Problem Of The Day
"Binary Modulo"

Solve the problem to win points

You are given a binary string s and an integer m. You need to return an integer r. Where r = k%m, k is the binary equivalent of string s.

Example 1:
Input:
s = "101"
m = 2
Output:
1
Explanation: Here k=5 because (101)2 = (5)10.
Hence 5 mod 2 = 1.

Example 2:
Input:
s = "1000"
m = 4
Output:
0
Explanation: Here k=8 and m=4 hence
r = k mod m = 8 mod 4 = 0.

Your Task:
You don't need to read input or print anything. Your task is to complete the function modulo() which takes the string s and integer m as input parameters and returns the value of r as described above.

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

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

Powered by hirist.com
👍4
Must Learn!💡
The AI chatbot is completely changed by ChatGPT. It has seized the AI market and established a powerful foothold there.

A new version of ChatGPT was thus released. An artificial intelligence model called GPT-4 has begun to be released by OpenAI and the company is backed by Microsoft Corp., to replace the highly successful ChatGPT technology.

In this article, we’ll discuss how ChatGPT-3 is different from GPT-4. Give it a read.

Link- https://www.geeksforgeeks.org/gpt-4-vs-gpt-3/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=gpt4vsgpt4
More dreams got their way to the beginning of a bright future.😃🤌

Are you still waiting? Why?🙄🤔

Wait no more, act now! Participate in Job Fair (for students) 2023 and make your way to a successful career.😃🙌

Apply here: https://www.geeksforgeeks.org/jobs?tab=studentjobfair
Problem Of The Day
"Count Binary Strings With No Consecutive 1s"

Solve the problem to win points

Given an integer N. Your task is to find the number of binary strings of length N having no consecutive 1s.
As the number can be large, return the answer modulo 10^9+7.

Example 1:
Input:
N = 3
Output:
5
Explanation:
All the binary strings of length 3 having
no consecutive 1s are "000", "001", "101",
"100" and "010".

Example 2:
Input:
N = 2
Output:
3
Explanation:
All the binary strings of length 2 having no
consecutive 1s are "10", "00" and "01".

Your Task:
You dont need to read input or print anything. Complete the function countStrings() which takes the integer N as the input parameter, and returns the number of binary strings of length N with no consecutive 1s.

Expected Time Complexity: O(log(N))
Expected Auxiliary Space: O(Height of the recursive call stack)

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

Powered by hirist.com
👍2
Must Learn!💡
Front-end Development is the part of web development that is focused on the user end of a website or web application.

Now, It completely depends on the project how much JavaScript knowledge is required in the project.

But, to become proficient in JavaScript one must have a good understanding of things that we will discuss in this article. Give it a read.

Link- https://www.geeksforgeeks.org/how-much-javascript-is-required-to-become-front-end-developer/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=how-much-javascript-is-required-to-become-front-end-developer%2F
👍2
🚨Job Alert🚨
Zyapaar is hiring for Dot Net Developer.

Location - Pune
Experience - Ahmedabad, Gujarat
Apply by - May 31, 2023

Apply via the following link and share the opportunity with your friends- https://www.geeksforgeeks.org/jobs/zyapaar-dotnet-developer?utm_source=telegram&utm_med[…]arketingteam_gfgmain&utm_campaign=zyapaar-dotnet-developer

📢 Also, do not miss the chance to get endless opportunities at Jobs Fair 2023 (Exclusively for Students) - https://www.geeksforgeeks.org/jobs?tab=studentjobfair
👍3
Problem Of The Day
"Total Cuts"

Solve the problem to win points

You are given an array A of N integers and an integer K, and your task is to find the total number of cuts that you can make such that for each cut these two conditions are satisfied-

1. A cut divides an array into two parts equal or unequal length (non-zero).
2. Sum of the largest element in the left part and the smallest element in the right part is greater than or equal to K.

Example 1:
Input:
N=3
K=3
A[]={1,2,3}
Output:
2
Explanation:
Two ways in which array is divided to satisfy above conditions are:
{1} and {2,3} -> 1+2>=3(satisfies the condition)
{1,2} and {3} -> 2+3>=3(satisfies the condition)

Example 2:
Input:
N=5
K=5
A[]={1,2,3,4,5}
Output:
3
Explanation:
{1,2} and {3,4,5} -> 2+3>=5
{1,2,3} and {4,5} -> 3+4>=5
{1,2,3,4} and {5} -> 4+5>=5

Your Task:
You don't need to read input or print anything. Your task is to complete the function totalCuts() which takes two integers N, K, and an array A of size N as input parameters, and returns an integer representing the total number of cuts that satisfy both conditions.

Expected Time Complexity: O(N)

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

Powered by hirist.com