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
Hey young coders! Get ready to learn and win exciting prizes!πŸ™Œβœ¨

Bi Wizard School Coding Tournament 14.0 is here!

Answer 3 coding questions and 20 quiz questions. Top 3 winners get - GFG Swag-Kit and Amazon Vouchers πŸ…

To get more information and register for the contest, click on the following link- https://practice.geeksforgeeks.org/contest/bi-wizard-school-coding-tournament-140?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=biwizard14
πŸ‘1
Problem Of The Day
"Game Of Subsets"

Solve the problem to win points

Elena is the topper of the class. Once her teacher asked her a problem. He gave Elena an array of intergers of length n. He calls a subset of array arr good if its product can be represented as a product of one or more distinct prime numbers. He asked her to find the number of different good subsets in arr modulo 109 + 7.

As a good friend of Elena help her to solve the problem.

Example 1:
Input:
N: 4
arr: {1,2,3,4}
Output: 6
Explanation:
The good subsets are:
- [1,2]: product is 2, which is the product of distinct
prime 2.
- [1,2,3]: product is 6, which is the product of
distinct primes 2 and 3.
- [1,3]: product is 3, which is the product of distinct
prime 3.
- [2]: product is 2, which is the product of distinct
prime 2.
- [2,3]: product is 6, which is the product of distinct
primes 2 and 3.
- [3]: product is 3, which is the product of distinct
prime 3.

Example 2:
Input:
N : 3
arr : {2, 2, 3}
Output: 5
Explanantion:
The good subsets are : {2}, {2}, {2, 3}, {2, 3}, {3}

Your Task:
The task is to complete the function goodSubsets() which takes an integer n and an array arr as the input parameters and should return the number of different good subsets.

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

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

Powered by hirist.com
πŸ‘3
Must Learn!πŸ’‘
A good design is something that has a balance of all the elements occurring in a sequence in an expected manner in front of the user so as to give a sense of familiarity.

In this article, we’ll be looking at some of the visual principles to impact your design.

This article is specially designed for UI designers to create a seamless and feature-rich user interface. Give it a read.

Link- https://www.geeksforgeeks.org/principles-of-visual-design-that-every-ui-designer-should-know/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=principlesofvisualdesign
πŸ‘1
We've reached contest #100!

And to celebrate with you all and to thank you for your support & participation, We have some rewards in store for you!

Learn more & register for Contest #100: https://bit.ly/3AuLdVP
Kickstart your journey towards success!πŸ˜ƒπŸ•Ί

It's time for freshers to rock and open the door of bright future. πŸ™Œ

Get placed at your dream organizations by making the first move of your career with us.

This is the right place and right time to start your journey because this time we are bringing a rage of opportunities for freshers and interns.πŸ₯³

Register Here: https://practice.geeksforgeeks.org/jobs?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=jobs
πŸ‘2πŸ”₯1
Problem Of The Day
"Seating Arrangement"

Solve the problem to win points

You are given an integer n, denoting the number of people who needs to be seated, and a list of m integers seats, where 0 represents a vacant seat and 1 represents an already occupied seat.

Find whether all n people can find a seat, provided that no two people can sit next to each other.

Example 1:
Input:
n = 2
m = 7
seats[] = {0, 0, 1, 0, 0, 0, 1}
Output:
Yes
Explanation:
The two people can sit at index 0 and 4.

Example 2:
Input:
n = 1
m = 3
seats[] = {0, 1, 0}
Output:
No
Explanation:
There is no way to get a seat for one person.

Your Task:
You don't have to input or print anything. Complete the function is_possible_to_get_seats() which takes the input parameters and return a boolean value, indicating whether all people can find a seat.

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

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

Powered by hirist.com
πŸ‘5❀1
Must Learn!πŸ’‘
Ever since the launch of ChatGPT in November, it has made people curious about its use.

While, people are happy about creating Chatbots, thinking that these AI-generated platforms will make things easier for them and help them grow.

However, people are concerned about their replacement due to ChatGPT, which has left thousands of jobs under the shadow.

So, is ChatGPT and Layoffs are related? This article will help you understand that. Give it a read.

Link- https://www.geeksforgeeks.org/is-chatgpt-and-layoffs-are-related/?utm_source=telegram&u[…]edium=marketingteam_gfgmain&utm_campaign=chatgptandlayoffs
πŸ‘1
Problem Of The Day
"Easy Task"

Solve the problem to win points

Given a string s whose length is n and array queries of length q where each elements of queries is either of type 1 query or type 2 query which is explained ahead.

There are two types of query.

Query type 1 : ["1",ind,char] "1" denotes this is type 1 query. In this query you have to change the character at index ind in s to character char.(Data type of ind,char is string in input)

Query Type 2: ["2",left,right,k] "2" denotes this is type 2 query. In this query you have to return kth lexographically largest character in the subtring of s (it is the kth largest character in sorted order , not the kth distinct character) starting from index left and ending at index right both left and right are inclusive. (Data type of left,right,k is string in input)

You have to perform each query in the same order as given in queries and return an array res such that res array contains the answer for each type2 query in same order as it appeared in queries.

Note : 0 based indexing is used.

Example 1:
Input:
n=4
s="abab"
q=2
queries={{"1","2","d"},{"2","1","3","1"}}
Output:
{"d"}
Explanation:
First query is of type 1 so after changing character at index 2
to d s becomes abdb . Now Second query is of type 2 in which
the 1st(k=1) lexographically largest character is "d" in substring "bdb"(s[1:3]). So we
returned a array with result of type 2 query {"d"}.

Example 2:
Input:
n=3
s="aaa"
q=3
queries={{"1","1","e"},{"1","2","c"},{"2","1","2","2"}}
Output:
{"c"}
Explanation:
After applying first two queries s becomes aec. Now for
the last query which is a type 2 second largest character
in subtring s starting from index 1 to ending at index 2 is "c".

Your Task:
You don't need to read input or print anything. Your task is to complete the function easyTask() which takes an integer n,string s,an integer q and an array queries which contains queries of type1 and type2 respectively and returns an array res such that res array contains the answer for each type2 query in same order as it appeared in queries.

Expected Time Complexity: O(N+(Q*logN))
Expected Space Complexity: O(N)

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

Powered by hirist.com
πŸ‘1
Just like Ankush, you can also have a smooth experience in the process of elevating your career.πŸ˜ƒπŸ€Œ

Visit our jobs portal 'Get Hired' and find your dream opportunity.πŸ™Œ

Link- https://www.geeksforgeeks.org/jobs
Must Learn!πŸ’‘
With each passing day ChatGPT is undergoing several test in several sectors. From content writing to writing a horror story, ChatGPT has it all.

Users from across the world have been utilizing it for all sorts of tasks. But the question remains- Can we use Chat GPT for market research?

But how? This article’s got everything that you need to know!

Link- https://www.geeksforgeeks.org/how-to-use-chat-gpt-for-market-research/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=chatgptformarketresearch
πŸ‘1
Problem Of The Day
"Geek's Village and Wells"

Solve the problem to win points

Geek's village is represented by a 2-D matrix of characters of size n*m, where

H - Represents a house
W - Represents a well
. - Represents an open ground
N - Prohibited area(Not allowed to enter this area)

Every house in the village needs to take the water from the well, as the family members are so busy with their work, so every family wants to take the water from the well in minimum time, which is possible only if they have to cover as less distance as possible. Your task is to determine the minimum distance that a person in the house should travel to take out the water and carry it back to the house.

A person is allowed to move only in four directions left, right, up, and down. That means if he/she is the cell (i,j), then the possible cells he/she can reach in one move are (i,j-1),(i,j+1),(i-1,j),(i+1,j), and the person is not allowed to move out of the grid.

Note: For all the cells containing 'N', 'W' and '.' our answer should be 0, and for all the houses where there is no possibility of taking water our answer should be -1.

Example 1:
Input:
n = 3
m = 3
c[][]: H H H
H W H
H H H
Output:
4 2 4
2 0 2
4 2 4
Explanation:
There is only one well hence all the houses present
in the corner of matrix will have to travel a minimum
distance of 4, 2 is for house to well and other two is
for well to house. And rest of the houses have to travel
a minimum distance of 2 (House -> Well -> House).

Example 2:
Input:
n = 5
m = 5
c[][]: H N H H H
N N H H W
W H H H H
H H H H H
H H H H H
Output:
-1 0 6 4 2
0 0 4 2 0
0 2 4 4 2
2 4 6 6 4
4 6 8 8 6
Explanation:
There is no way any person from the house in
cell (0,0) can take the water from any well, and
for rest of the houses there is same type of
strategy we have to follow as followed in example 1.

Your Task:
You don't need to read input or print anything. Your task is to complete the function geekAndWells() which takes n and m, dimensions of the grid, and a 2-D grid of size n*m and returns a 2-D array containing the minimum distance for all the houses as explained above.

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

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

Powered by hirist.com
πŸ‘2❀1
Must Learn!πŸ’‘
Our minds work hard to interpret the things we perceive when we look at the world.

The various ways that our minds interpret that order is described by the Gestalt principles.

There are a total of β€œ10 Gestalt Principles” that come in handy to designers. This article talks about them in detail. Give it a read.

Link- https://www.geeksforgeeks.org/top-gestalt-principles-that-every-designer-should-know/?u[…]=marketingteam_gfgmain&utm_campaign=top-gestalt-principles
πŸ‘3
Problem Of The Day
"Find Number"

Solve the problem to win points

Given an integer N, You need to find the Nth smallest number which only contains odd digits i.e. 1,3,5,7,9 means no even digits are allowed on that number (12 will not consider). For example, the starting numbers which only contain odd digits are 1,3,5,7,9,11,13,15,17,19,31,33,35 and so on.

Example 1:
Input:
N=3
Output:
5
Explanation:
First three numbers are 1, 3, 5.
Here 5 is the 3rd number, where contains
only odd digits.

Example 2:
Input:
N=13
Output:
35
Explanation:
First 13 numbers are 1,3,5,7,9,
11,13,15,17,19,31,33,35, here 35
is the answer.

Your Task:
You don't need to read input or print anything. Your task is to complete the function findNumber() which takes a single variable N and returns the smallest Nth number which only contains odd digits.

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

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

Powered by hirist.com
πŸ‘2
🚨Job Alert🚨
MasterCard is hiring for SDE-I.

Location - Pune, India
Experience - Upto 1 Years
Apply by - May 27, 2023

Apply via the following link and share the opportunity with your friends- https://practice.geeksforgeeks.org/jobs/Mastercard_Externa_Fresher?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=mastercard_externa_fresher
πŸ‘3❀1
Must Learn!πŸ’‘
When it comes to salary, it is very subjective to the individual organization, job role, experience level, where you are working, and work expertise.

In this article, we’ll cover UX Designer Salaries in India and Abroad. Give it a read.

Link- https://www.geeksforgeeks.org/ux-designer-salary-in-india-and-abroad/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=ux-designer-salary-in-india-and-abroad
Problem Of The Day
"Powerfull Integer"

Solve the problem to win points

Your are given an 2D integer array intervals whose length is n where intervals[i]=[start,end] means all integers from start to end inclusive start and end are also present and also we are given an integer k . We have to return the Powerfull Integer.Powerfull Integer is that integer that occurs at least k times and if multiple integers have at least k occurences we have to return the maximum integer out of all those elements .

Note: If no integer occurs at least k times return -1 in that case .

Example 1:
Input :
n=3
intervals={{1,3},{4,6},{3,4}}
k=2
Output: 4
Explanation:
As we can see that 3 and 4 are the 2 integers
that have 2 occurences(2>=k) so we have 4
in this case as the Powerfull integer as it
is the maximum element which satisfies the condition.

Example 2:
Input :
n=4
intervals={{1,4},{12,45},{3,8},{10,12}}
k=3
Output: -1
Explanation:
As we can see that no integer occurs
3 times so in that case we have to
return -1 (see Note).

Your Task:
You don't need to read input or print anything. Your task is to complete the function powerfullInteger() which takes an integer n, a 2d array intervals and an integer k respectively and you have to return powerfull Integer if it exists else return -1.

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

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

Powered by hirist.com
πŸ‘1
Must Learn!πŸ’‘
Debugging is the process of finding and fixing errors or bugs in the source code of any software.

Debugging is a critical part of the software development process, and there are several ways to debug Java code. This article talks about some of the most common ways to debug Java code. Give it a read.

Link- https://www.geeksforgeeks.org/top-5-java-debugging-tips/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=top-5-java-debugging-tips
🚨Job Alert🚨
Saturo Technologies is hiring for Java Developer.

Location - Pune
Experience - Fresher
Apply by - May 27, 2023

Apply via the following link and share the opportunity with your friends- https://practice.geeksforgeeks.org/jobs/Saturo-Technologies-Pvt-Ltd-Java-Developer?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=javadeveloper
πŸ‘1
Problem Of The Day
"Subtree In N-ary Tree"

Solve the problem to win points

Given the root of a n-ary tree find the number of duplicate subtrees in the n-ary tree. Two trees are duplicates if they have the same structure with the same node values.

Example 1:
Input:
1 N 2 2 3 N 4 N 4 4 3 N N N N N

Output:
2
Explanation:
[4], [3] are duplicate subtree.

Example 2:
Input:
1 N 2 3 N 4 5 6 N N N N

Output:
0
Explanation:
No duplicate subtree found.
Your Task:
You don't need to read input or print anything. Your task is to complete the function duplicateSubtreeNaryTree() which takes the root of the n-ary tree as input and returns an integer value as a number of duplicate subtrees.

Expected Time Complexity: O(n), n is the total no of nodes
Expected Space Complexity: O(n2)

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

Powered by hirist.com
πŸ‘3
Must Learn!πŸ’‘
Data Science is one of the most demanding skills in today's times. You must have basic skills like a programming language, and statistics before you dwell into it.

You can also become a data scientist by just going through the basic to advanced-level concepts.

This article will introduce 10 best data science courses online for beginners. Give it a read.

Link- https://www.geeksforgeeks.org/best-data-science-courses-online/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=bestdatasciencecourses
πŸ‘1