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
"Next Happy Number"

For a given non-negative integer N, find the next smallest Happy Number. A number is called Happy if it leads to 1 after a sequence of steps. Wherein at each step the number is replaced by the sum of squares of its digits that is, if we start with Happy Number and keep replacing it with sum of squares of its digits, we reach 1 at some point.

Example 1:

Input:
N = 8
Output:
10
Explanation:
Next happy number after 8 is 10 since
1*1 + 0*0 = 1

Example 2:

Input:
N = 10
Output
13
Explanation:
After 10, 13 is the smallest happy number because
1*1 + 3*3 = 10, so we replace 13 by 10 and 1*1 + 0*0 = 1.

Your Task:
You don't need to read input or print anything. Your task is to complete the function nextHappy() which takes an integer N as input parameters and returns an integer, next Happy number after N.

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

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/next-happy-number4538/1
πŸ‘3
Problem Of The Day
"Is Binary Number Multiple of 3"

Given a number in its binary form find if the given binary number is a multiple of 3. It is recommended to finish the task using one traversal of input binary number.

Example 1:

Input: S = "0011"
Output: 1
Explanation: "0011" is 3, which is divisible by 3.

Example 2:

Input: S = "100"
Output: 0
Explanation: "100"'s decimal equivalent is 4, which is not divisible by 3.

Your Task:
You don't need to read input or print anything. Your task is to complete the function isDivisible() which takes the string s as inputs and returns 1 if the given number is divisible by 3 otherwise 0.

Expected Time Complexity: O(|S|)
Expected Auxiliary Space: O(1)

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/is-binary-number-multiple-of-30654/1
❀2πŸ‘2πŸ‘Ž1
Media is too big
VIEW IN TELEGRAM
GET. SET. PLAY. πŸ’ͺ

The most thrilling and rewarding event of the yearβ€” Geek Olympics is going live in just a few days πŸ”₯πŸ”₯

Register Here: https://bit.ly/3NRkavk
Must Learn!πŸ’‘
The goal of competitive programming is to write code to solve a problem within a given timeframe.

There are mainly mathematical and logical problems in coding competitions based on Number Theory, Graph Theory, P&C (Permutation and Combination), Games, Geometry, etc.

In this article, we have listed several reasons for doing competitive programming. Give it a read.

Link- https://www.geeksforgeeks.org/why-should-you-do-competitive-programming/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=github
πŸ‘3❀2
Problem Of The Day
"Number of 1 Bits"

Given a positive integer N, print count of set bits in it.

Example 1:

Input:
N = 6
Output:
2
Explanation:
Binary representation is '110'
So the count of the set bit is 2.

Example 2:

Input:
8
Output:
1
Explanation:
Binary representation is '1000'
So the count of the set bit is 1.

Your Task:
You don't need to read input or print anything. Your task is to complete the function setBits() which takes an Integer N and returns the count of number of set bits.

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

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/set-bits0143/1
πŸ‘4πŸ₯±3πŸ₯°1
Must Learn!πŸ’‘
There has always been a heated debate over which one to choose from Node.js or Django. In this blog, we will be addressing the same.

Let's get to learn about the significant differences between Node.js or Django via this article. Give it a read.

Link- https://www.geeksforgeeks.org/nodejs-vs-django/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=github
πŸ‘2
Problem Of The Day
"Copy Set Bits in Range"

Given two numbers X and Y, and a range [L, R] where 1 <= L <= R <= 31. You have to copy the set bits of 'Y' in the range L to R in 'X'. Return this modified X.

Note: Range count will be from Right to Left & start from 1.

Example 1:

Input:
X = 44, Y = 3
L = 1, R = 5
Output:
47
Explaination:
Binary represenation of 44 and 3 is 101100 and 000011. So in the range 1 to 5 there are two set bits of 3 (1st & 2nd position). If those are set in 44 it will become 101111 which is 47.

Example 2:

Input:
X = 16, Y = 2
L = 1, R = 3
Output: 18
Explaination: Binary represenation of 16 and 2 is 10000 and 10. If the mentioned conditions are applied then 16 will become 10010 which is 18.

Your Task:
You do not need to read input or print anything. Your task is to complete the function setSetBit() which takes the numbers X, Y, L and R as input parameters and returns the modified value of X.

Expected Time Complexity: O(R - L)
Expected Auxiliary Space: O(1)

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/copy-set-bits-in-range0623/1
πŸ‘5
Problem Of The Day
"Maximum Index"

Given an array arr[] of n positive integers. The task is to find the maximum of j - i subjected to the constraint of arr[i] <= arr[j].

Example 1:

Input:
n = 9
arr[] = {34, 8, 10, 3, 2, 80, 30, 33, 1}
Output:
6
Explanation:
In the given array arr[1] < arr[7] satisfying
the required condition (arr[i] <= arr[j]) thus
giving the maximum difference of j - i which is
6(7-1).

Example 2:

Input:
N = 2
arr[] = {18, 17}
Output:
0
Explanation:
We can either take i and j as 0 and 0
or we cantake 1 and 1 both give the same result 0.

Your Task:
Complete the function maxIndexDiff() which takes array arr and size n, as input parameters and returns an integer representing the answer. You don't to print answer or take inputs.

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

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/maximum-index3307/1
Must Learn!πŸ’‘
Whether a teacher, student, or professional, anyone can use this tool and impress the audience hence, leaving an everlasting impression.

That’s why we’ve compiled a list of the 10 Best AI presentation Makers, guaranteed to help you ace your next presentation. But before jumping to the list, let’s understand what is AI Presentation Tool and why you need to create a good presentation.

Link- https://www.geeksforgeeks.org/best-ai-presentation-maker/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=github
❀3πŸ‘1
Problem Of The Day
"Count the subarrays having product less than k"

Given an array of positive numbers, the task is to find the number of possible contiguous subarrays having product less than a given number k.

Example 1:

Input :
n = 4, k = 10
a[] = {1, 2, 3, 4}
Output :
7
Explanation:
The contiguous subarrays are {1}, {2}, {3}, {4}
{1, 2}, {1, 2, 3} and {2, 3} whose count is 7.

Example 2:

Input:
n = 7 , k = 100
a[] = {1, 9, 2, 8, 6, 4, 3}
Output:
16

Your Task:
You don't need to read input or print anything. Your task is to complete the function countSubArrayProductLessThanK() which takes the array a[], its size n and an integer k as inputs and returns the count of required subarrays.

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

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/count-the-subarrays-having-product-less-than-k1708/1
πŸ‘1
Must Learn!πŸ’‘
Are you also puzzled by these questions, don’t worry you are not alone. It is the problem of every Computer science enthusiast.

Most of the time this question arises in a student’s mind whether to focus on Data Structures and Algorithms or perform hands-on development!!

Link- https://www.geeksforgeeks.org/how-to-manage-dsa-and-development-together/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=github
πŸ‘3
🚨Job Alert🚨
Axelor is hiring for Node JS Developer.

Location - Bangalore, Karnataka | Surat, Gujrat
Experience - 1 - 4 Years
Apply by - Jul 20, 2023

Apply via the following link and share the opportunity with your friends- https://practice.geeksforgeeks.org/jobs/axelor-nodejsdeveloper?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=nodejsdeveloper
Problem Of The Day
"Stock buy and sell II"

The cost of stock on each day is given in an array price[] of size n. Each day you may decide to either buy or sell the stock i at price[i], you can even buy and sell the stock on the same day, Find the maximum profit which you can get.

Note: You can only hold one stock at a time.

Example 1:

Input:
n = 4
a = {3, 4, 1, 5}
Output:
5
Explanation:
We can buy stock on day 1 (at price 3) and sell it on
day 2 (at price 4) profit will be 4-3=1,
We can buy another stock on day 3 (at price 1) and sell
it on day 4 (at price 5) profit will be 5-1=4,
which will give us maximum profit of 5.

Example 2:

Input:
n = 5
a = {1, 3, 5, 7, 9}
Output:
8
Explanation:
We can buy stock on day 1 (at price 1) and sell it on
day 5 (at price 9),
which will give us maximum profit of 8.

Your Task:
Complete stockBuyAndSell() function which takes an array of Prices as input and returns the maximum profit achieved as described in the problem statement.

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

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/stock-buy-and-sell2615/1
πŸ‘3
Must Learn!
With the rise in artificial intelligence (AI), the whole picture for data analysis has changed, to a more productive, precise, and perceptive compared to ever.

We will go into the world of AI-powered data analysis tools in this article and examine the top possibilities and avenues.

Advanced technologies like machine learning automate processes, spot trends, and produces information that can be put to use.

Link- https://www.geeksforgeeks.org/best-ai-tools-for-data-analysis/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=github
The clock is ticking!⏰ Just a few hours left.⏳ We wish you all the best!πŸ˜ƒπŸ‘

Be ready tonight for the contest that will change your life.πŸ‘©β€πŸ’»

Register Here: https://practice.geeksforgeeks.org/contest/megajob-a-thon-hiring-challenge-freshers?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=megajobathon
πŸ‘4
Problem Of The Day
"Quick Sort"

Quick Sort is a Divide and Conquer algorithm. It picks an element as a pivot and partitions the given array around the picked pivot.
Given an array arr[], its starting position is low (the index of the array) and its ending position is high(the index of the array).

Note: The low and high are inclusive.

Implement the partition() and quickSort() functions to sort the array.

Example 1:

Input:
N = 5
arr[] = { 4, 1, 3, 9, 7}
Output:
1 3 4 7 9

Example 2:

Input:
N = 9
arr[] = { 2, 1, 6, 10, 4, 1, 3, 9, 7}
Output:
1 1 2 3 4 6 7 9 10

Your Task:
You don't need to read input or print anything. Your task is to complete the functions partition() and quickSort() which takes the array arr[], low and high as input parameters and partitions the array. Consider the last element as the pivot such that all the elements less than(or equal to) the pivot lie before it and the elements greater than it lie after the pivot.

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

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/quick-sort/1
πŸ‘2
Must Learn!πŸ’‘
Aspiring testers and experienced professionals must be updated with the latest software testing trends and technology trends.

Books provide an invaluable resource for learning and expanding one’s knowledge in software testing. You should enhance your skills with software testing books to excel in your career.

In this article, we have combined a list of the top 12 software testing books for manual and automation testing.

Link- https://www.geeksforgeeks.org/software-testing-books/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=github
πŸ‘1
🚨Job Alert🚨
Phaxon Services is hiring for SAP HCM Consultant.

Location - Noida, Uttar Pradesh
Experience - 7 - 9 Years
Apply by - Jul 05, 2023

Apply via the following link and share the opportunity with your friends- https://www.geeksforgeeks.org/jobs/phaxon-saphcmconsultant?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=github
Problem Of The Day
"Merge Without Extra Space"

Given two sorted arrays arr1[] and arr2[] of sizes n and m in non-decreasing order. Merge them in sorted order without using any extra space. Modify arr1 so that it contains the first N elements and modify arr2 so that it contains the last M elements.

Example 1:

Input:
n = 4, arr1[] = [1 3 5 7]
m = 5, arr2[] = [0 2 6 8 9]
Output:
arr1[] = [0 1 2 3]
arr2[] = [5 6 7 8 9]
Explanation:
After merging the two
non-decreasing arrays, we get,
0 1 2 3 5 6 7 8 9.

Example 2:

Input:
n = 2, arr1[] = [10 12]
m = 3, arr2[] = [5 18 20]
Output:
arr1[] = [5 10]
arr2[] = [12 18 20]
Explanation:
After merging two sorted arrays
we get 5 10 12 18 20.

Your Task:
You don't need to read input or print anything. You only need to complete the function merge() that takes arr1, arr2, n and m as input parameters and modifies them in-place so that they look like the sorted merged array when concatenated.

Expected Time Complexity: O((n+m) log(n+m))
Expected Auxilliary Space: O(1)

Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/merge-two-sorted-arrays-1587115620/1
πŸ‘2❀1
Must Learn!πŸ’‘
The COVID-19 pandemic has caused a multitude of transformations and trials across various aspects of our existence, encompassing ways of conducting job interviews.

In the time before the global health crisis, in-person interviews prevailed as the common approach, while phone interviews were relatively rare occurrences.

Link- https://www.geeksforgeeks.org/phone-interview-questions/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=github
πŸ‘1