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
"Max min Height"

Solve the problem to win points

You have a garden with n flowers lined up in a row. The height of ith flower is ai units. You will water them for k days. In one day you can water w continuous flowers (you can do this only once in a single day). Whenever you water a flower its height increases by 1 unit. You need to maximize the height of the smallest flower all the time.

Example 1:
Input:
n=6
k=2
w=3
a[]={2,2,2,2,1,1}
Output:
2
Explanation:
Water last three flowers for first day &
first three flowers for second day.The
new heights will be {3,3,3,3,2,2}

Example 2:
Input:
n=2
k=5
w=1
a[]={5,8}
Output:
9
Explanation:
For the first four days water the first flower then
water the last flower once.
Your Task:
You don't need to read input or print anything. Your task is to complete the function maximizeMinHeight() which takes the array a[], its size N, integer K, and an integer W as input parameters and returns the maximum height possible for the smallest flower.

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

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

Powered by hirist.com
πŸ‘1
Problem Of The Day
"Find anagrams in linked list"

Solve the problem to win points

Given a linked list of characters and a string S.Return all the anagrams of the string present in the given linked list.In case of overlapping anagrams choose the first anagram from left.

Example 1:
Input: a -> b -> c -> a -> d -> b -> c -> a
S = bac
Output: [a -> b -> c, b -> c -> a]
Explanation: In the given linked list,
there are three anagrams:
1. a -> b -> c -> a -> d -> b -> c -> a
2. a -> b -> c -> a -> d -> b -> c -> a
3. a -> b -> c -> a -> d -> b -> c -> a
But in 1 and 2, a -> b -> c and b -> c-> a
are ovelapping.So we take a -> b -> c as it
comes first from left.So the output is:
[a->b->c,b->c->a]

Example 2:
Input: a -> b -> d -> c -> a
S = bac
Output: -1
Explanation: There is no anagrams, so output is -1

Your Task:
You don't need to read input or print anything. Your task is to complete the function findAnagrams() which takes head node of the linked list and a string S as input parameters and returns an array of linked list. If there is no anagram in the linked list,return -1.


Expected Time Complexity: O(N), where N is length of LinkedList
Expected Auxiliary Space: O(1)

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

Powered by hirist.com
πŸ‘5
Problem Of The Day
"Maximum Triplet product"

Solve the problem to win points

Given an array arr of size n, the task is to find the maximum triplet product in the array.

Example 1:
Input:
n = 4
arr[] = {1, 2, 3, 5}
Output:
30
Explanation:
5*3*2 gives 30. This is the maximum possible
triplet product in the array.

Example 2:
Input:
n = 7
arr[] = {-3, -5, 1, 0, 8, 3, -2}
Output:
120
Explanation:
-3*-5*8 gives 120. This is the maximum possible triplet product in the array.

Your Task:
You don't need to read input or print anything. Your task is to complete the function maxTripletProduct() which takes an integer n and an array arr and returns the maximum triplet product in the array.


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

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

Powered by hirist.com
πŸ‘5
Must Learn!πŸ’‘
If you are a Linux user, you can explore various desktop environments to tweak your GUI, like Windows and macOS.

the enormous list of desktop environments may confuse you when choosing the correct one for the system.

So, in this article, we will give you brief information about the best Linux desktop environments. Give it a read.

Link- https://www.geeksforgeeks.org/best-linux-desktop-environments/?utm_source=Telegram&utm_medium=marketingteam_gfgmain&utm_campaign=9BestLinuxDesktopEnvironments
No more wait! It's time to take action!!!

Hurry up and enjoy the best opportunities at Job Fair 2023.πŸ˜ƒπŸ™Œ

Link- https://practice.geeksforgeeks.org/jobs?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=jobfair2023
Problem Of The Day
"Yet another query problem"

Solve the problem to win points

You are given an array of N elements and num queries, In each query you are given three numbers L,R and K and you have to tell, how many indexes are there in between L and R(L<=i<=R) such that the frequency of a[i] from index i to n-1 is k.

Note: 0-based indexing

Example 1:
Input:
N=5
num=3
A={1,1,3,4,3}
Q={{0,2,2},{0,2,1},{0,4,2}}
Output:
2 1 2
Explanation:
For query 1: 0 2 2
L=0,R=2,K=2
let, L<=i<=R
For i=0: frequency of a[i] i.e. 1 from i to n-1 is 2.
For i=1: frequency of a[i] i.e. 1 from i to n-1 is 1.
For i=2: frequency of a[i] i.e. 3 from i to n-1 is 2.
Hence we have two elements from index 0 to 2
whose frequency from i to n-1 is 2.

For query 2: 0 2 1
L=0,R=2,K=1
As we can see from the above query that there is
only a single element in 0 to 2 whose frequency
from i to n-1 is 1.

For query 3: 0 4 2
The answer will be 2 because of the index 0 and 2.

Example 2:
Input:
N=5
num=2
A={1,1,1,1,1}
Q={{0,4,2},{0,4,1}}
Output:
1 1
Explanation:
For query 1: 0 4 4
L=0,R=4,K=4
let, L<=i<=R
For i=0: frequency of a[i] i.e. 1 from i to n-1 is 5.
For i=1: frequency of a[i] i.e. 1 from i to n-1 is 4.
For i=2: frequency of a[i] i.e. 1 from i to n-1 is 3.
For i=3: frequency of a[i] i.e. 1 from i to n-1 is 2.
For i=4: frequency of a[i] i.e. 1 from i to n-1 is 1.
Hence we have one elements from index 0 to 4 whose frequency from i to n-1 is 2.

Similarly For query 2:
there is only 1 element in 0 to 4 whose frequency from i to n-1 is 1.
Expected Time Complexity: O(N2)
Expected Auxiliary Space: O(N2)

Your Task:
You don't need to read input or print anything. Your task is to complete the function solveQueries() which take two variable N and num representing the length of the original array and number of queries and two arrays as input, A and Q representing the original array and an array of queries(2-D array with 3 columns of L,R and K respectively), and returns the array of length num with the solution to each query.

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

Powered by hirist.com
πŸ‘3
Must Learn!πŸ’‘
Software Development holds the title of being among the high paying jobs.

However, it's a half-truth. There are many other jobs that are as in-demand and high-paying as Software Development.

We have brought a list of the 10 highest-paying technical jobs other than software developers to help you in deciding which one suits you better.

Also in this article, minimum eligibility criteria are mentioned in case you need to enter into that particular field. Give it a read.

Link- https://www.geeksforgeeks.org/highest-paying-technical-jobs-other-than-software-developers/?utm_source=Telegram&utm_medium=marketingteam_gfgmain&utm_campaign=highest-paying-jobs-other-than-software-development
πŸ‘3❀1πŸ‘Ž1
Problem Of The Day
"Binary matrix having maximum number of 1s"

Solve the problem to win points

Given a binary matrix (containing only 0 and 1) of order NxN. All rows are sorted already, We need to find the row number with the maximum number of 1s. Also, find the number of 1s in that row.
Note:

1. In case of a tie, print the smaller row number.
2. Row number should start from 0th index.

Example 1
Input:
N=3
mat[3][3] = {0, 0, 1,
0, 1, 1,
0, 0, 0}
Output:
Row number = 1
MaxCount = 2
Explanation:
Here, max number of 1s is in row number 1
and its count is 2.

Example 2
Input:
N=3
mat[3][3] = {1, 1, 1,
1, 1, 1,
0, 0, 0}
Output:
Row number = 0
MaxCount = 3
Your Task:
You don't need to read input or print anything. The task is to complete the function findMaxRow() which takes mat[][] as the 2D matrix and N as the size of matrix. Your task is to find the row number with the maximum number of 1s and find the number of 1s in that row and return the answer in a vector of size 2 where at 0th index will be the row number and at 1th index will be MaxCount.

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

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

Powered by hirist.com
πŸ‘1
Must Learn!πŸ’‘
The best way to master a new skill is to practice it and implement those by building some projects.

It’s very important for individuals to learn new concepts and develop some amazing coding projects for beginners to kickstart their careers.

This article is best for the budding coders as it will help them with project idea at initial level.
Give it a read.

Link- https://www.geeksforgeeks.org/coding-projects-for-beginners/?utm_source=Telegram&utm_medium=marketingteam_gfgmain&utm_campaign=coding-projects-for-beginners
πŸ‘2😁1
Problem Of The Day
"Maximum Possible Value"

Solve the problem to win points

Given two arrays A[] and B[] of same length N. There are N types of sticks of lengths specified. Each stick of length A[i] is present in B[i] units (i=1 to N). You have to construct the squares and rectangles using these sticks. Each unit of a stick can be used as length or breadth of a rectangle or as a side of square. A single unit of a stick can be used only once.

Let S be the sum of lengths of all sticks that are used in constructing squares and rectangles. The task is to calulate the maximum possible value of S.

Example 1:
Input:
N = 4
A[] = {3,4,6,5}
B[] = {2,3,1,6}
Output:
38
Explanation:
There are 2 sticks of length 3.
There are 3 sticks of length 4.
There is a 1 stick of length 6.
There are 6 sticks of length 5.
One square can be made using 4 sticks of
4th kind (5*4=20)
A rectangle can be made using 2 sticks of
4th kind and 2 sticks of 2nd kind (5*2+4*2=18)
S = 20 + 18 = 38

Example 2:
Input:
N = 1
A[] = {3}
B[] = {2}
Output:
0
Explanation:
There are only 2 sticks of length 3 which are
not enough to make the square or rectangle.

Your Task:
You don't need to read input or print anything. Complete the function maxPossibleValue( ) which takes the integer N , the array A[], and the array B[] as input parameters and returns the maximum possible value of S.

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

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

Powered by hirist.com
πŸ‘4
Only 7 days left...
Don't let your future wait!🀝
Get your dream job at your dream organization.

Hurry up!

Get Hired - https://practice.geeksforgeeks.org/jobs?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=jobfair2023
πŸ‘1πŸ”₯1
Learn more!πŸ’‘
Linux is one the most popular operating systems with a fast-growing user base.

Many users prefer other operating systems because Linux can give a frustrating experience if a user makes some mistakes as a beginner.

This article talks about the common mistakes Linux beginners make, read the following article. Give it a read.

Link- https://www.geeksforgeeks.org/7-common-mistakes-linux-beginners-make/?utm_source=Telegram&utm_medium=marketingteam_gfgmain&utm_campaign=7-common-mistakes-linux-beginners-make
🚨Job Alert🚨
WebOccult Technologies is hiring for AI/ML Developer.

Location - Ahmedabad, Gujarat
Experience - 2 - 8 Years
Apply by - Mar 31, 2023

Apply via the following link and share the opportunity with your friends- https://practice.geeksforgeeks.org/jobs/WebOccult-AIMLDeveloper?utm_source=Telegram&utm_medium=marketingteam_gfgmain&utm_campaign=WebOccult-AIMLDeveloper

πŸ“’: 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
"Maximum Number of coins"

Solve the problem to win points

We have been given N balloons, each with a number of coins associated with it. On bursting a balloon i, the number of coins gained is equal to A[i-1]*A[i]*A[i+1].
Also, balloons i-1 and i+1 now become adjacent. Find the maximum possible profit earned after bursting all the balloons. Assume an extra 1 at each boundary.

Example 1:
Input:
N=2
a[]={5, 10}
Output:
60
Explanation: First Burst 5, Coins = 1*5*10
Then burst 10, Coins+= 1*10*1
Total = 60

Example 2:
Input:
N=4
a[] = {3,1,5,8}
Output:
167
Explanation:
nums = [3,1,5,8] --> [3,5,8] --> [3,8] --> [8] --> []
coins = 3*1*5 + 3*5*8 + 1*3*8 + 1*8*1 = 167.
Your Task:
You don't need to read input or print anything. Your task is to complete the function maxCoins() which takes the array arr[], its size N, and returns the maximum number of coins that can be collected.

Expected Time Complexity: O(N^3)
Expected Space Complexity: O(N^2)

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

Powered by hirist.com
πŸ‘2❀1
Problem Of The Day
"Special Palindrome Substrings"

Solve the problem to win points

Given two strings s1 and s2, The task is to convert s1 into a palindrome such that s1 contain s2 as a substring in a minimum number of operation.
In a single operation, we can replace any word of s1 with any character.

Note: If it is not possible to convert s1 such that it is a palindrome as well as contains substring of s2, then return -1.

Example 1:
Input:
s1="abaa" s2="bb"
Output: 1
Explanation:
we can replace s1[2]='a' with 'b'.
So the new s1 will be like "abba",
having s2 as a substring.

Example 2:
Input:
s1="abbd" s2="mr"
Output: 4
Explanation:
1st: s1="mrbd" --> 2 operations (this is the
minimum operation to make s2 a substring of s1)
2nd: s1="mrrm" --> 2 operations
(this is the minimum operation to make s1 palindrome)
Your Task:
You don't need to read input or print anything. Complete the function specialPalindrome() which takes the two strings s1 and s2 as input parameters. Return the minimum number of operations needs to convert s1 such that it is a palindrome and having s2 as a substring in s1.

Expected Time Complexity: O(N*M) [N: size of s1 and M: size of s2]
Expected Auxiliary Space: O(N)

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

Powered by hirist.com
πŸ‘2
No more wait because the right time is now!

Here we are with the fest of opportunities at Job-A-Thon 18. Embrace your future by working with your dream organizations.πŸ™Œβœ¨

It's time for you make the move you've waiting for to do. Hurry up!πŸ˜ƒπŸ€Œ

Register here: https://practice.geeksforgeeks.org/contest/job-a-thon-18-hiring-challenge?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=job-a-thon-18-hiring-challenge
Must Learn!πŸ’‘

There is a set of widely accepted psychology laws, or standards, which are frequently used by UX designers to guide their design decisions.

These principles create a greater impact while explaining a point to either a designer or non-designer.

So, to be a better designer and to create a better impact to produce winning ideas must adhere to them.

This article talks about the 15 laws of UX that every designer must know. Give it a read.

Link- https://www.geeksforgeeks.org/15-laws-of-ux-that-every-designer-should-know/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=15-laws-of-ux-that-every-designer-should-know
Problem Of The Day
"Second smallest number"

Solve the problem to win points

The task is to find the second smallest number with a given sum of digits as S and the number of digits as D.

Example 1:
Input:
S = 9
D = 2
Output:
27
Explanation:
18 is the smallest number possible with sum = 9
and total digits = 2, Whereas the second
smallest is 27.

Example 2:
Input:
S = 16
D = 3
Output:
178
Explanation:
169 is the smallest number possible with sum is
16 and total digits = 3, Whereas the second
smallest is 178.

Your Task:
You don't need to read input or print anything. Your task is to complete the function secondSmallest() which takes the two integers S and D respectively and returns a string which is the second smallest number if possible, else return "-1".

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

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

Powered by hirist.com
πŸ‘1
Must Learn!πŸ’‘
Microservice is a service that is responsible for software development.

It helps you to identify future debugging problems and allows you to check architecture for service and performance.

This article talks about Mcroservices in detail. Give it a read.

Link- https://www.geeksforgeeks.org/microservices/?utm_source=Telegram&utm_medium=marketingteam_gfgmain&utm_campaign=microservices
πŸ‘2
Only 4 days left!
Get your dream job at your dream organization.βœ¨πŸ™Œ

Hurry up!

Link- https://practice.geeksforgeeks.org/jobs?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=jobfair2023