This media is not supported in your browser
VIEW IN TELEGRAM
Must Learn!💡
In recent days Python has gained popularity and has a powerful programming language. It has a lot of features that make it stand apart from other programming languages, like versatility and ease of use versatility and ease of use which is helpful for beginners.
So, how can you maximize your Python Code Performance?
We got your back! This article talks about the tips that will be helpful for you to become a pro in the programming language. Give it a read.
Link - https://www.geeksforgeeks.org/tips-to-maximize-your-python-code-performance/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=Pensieveid_BackenDev&utm_term=pythonperformance
In recent days Python has gained popularity and has a powerful programming language. It has a lot of features that make it stand apart from other programming languages, like versatility and ease of use versatility and ease of use which is helpful for beginners.
So, how can you maximize your Python Code Performance?
We got your back! This article talks about the tips that will be helpful for you to become a pro in the programming language. Give it a read.
Link - https://www.geeksforgeeks.org/tips-to-maximize-your-python-code-performance/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=Pensieveid_BackenDev&utm_term=pythonperformance
👍2
Problem Of The Day
"Balloon Everywhere"
Solve the problem to win points
Bob is very fond of balloons. Once he visited an amusement park with his mother. The mother told Bob that she would buy him a balloon only if he answer her problem right. She gave Bob a string S [contains only lowercase characters] and asked him to use the characters of string to form as many instances of the word "balloon" as possible. Return the maximum number of instances that can be formed.
Help Bob to solve the problem.
Note: You can use each character in the string at most once.
Example 1:
Input:
S: nlaebolko
Output: 1
Explanation:
Here, the number of occurence of 'b' = 1
of occurence of 'a' = 1
of occurence of 'l' = 2
of occurence of 'o' = 2
of occurence of 'n' = 1
So, we can form 1 "balloon" using the letters.
Example 2:
Input:
S: loonbalxballpoon
Output: 2
Explanation:
Here, the number of occurence of 'b' = 2
of occurence of 'a' = 2
of occurence of 'l' = 4
of occurence of 'o' = 4
of occurence of 'n' = 2
So, we can form 2 "balloon" using the letters.
Your Task:
The task is to complete the function maxInstance() which takes a string as the only input parameter and should return the maximum instances that can be formed of the word "balloon" using the given string.
Expected Time Complexity: O(n), n is size of the given string.
Expected Auxiliary Space: O(26).
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/45fa306a9116332ece4cecdaedf50f140bd252d4/1
Powered by hirist.com
"Balloon Everywhere"
Solve the problem to win points
Bob is very fond of balloons. Once he visited an amusement park with his mother. The mother told Bob that she would buy him a balloon only if he answer her problem right. She gave Bob a string S [contains only lowercase characters] and asked him to use the characters of string to form as many instances of the word "balloon" as possible. Return the maximum number of instances that can be formed.
Help Bob to solve the problem.
Note: You can use each character in the string at most once.
Example 1:
Input:
S: nlaebolko
Output: 1
Explanation:
Here, the number of occurence of 'b' = 1
of occurence of 'a' = 1
of occurence of 'l' = 2
of occurence of 'o' = 2
of occurence of 'n' = 1
So, we can form 1 "balloon" using the letters.
Example 2:
Input:
S: loonbalxballpoon
Output: 2
Explanation:
Here, the number of occurence of 'b' = 2
of occurence of 'a' = 2
of occurence of 'l' = 4
of occurence of 'o' = 4
of occurence of 'n' = 2
So, we can form 2 "balloon" using the letters.
Your Task:
The task is to complete the function maxInstance() which takes a string as the only input parameter and should return the maximum instances that can be formed of the word "balloon" using the given string.
Expected Time Complexity: O(n), n is size of the given string.
Expected Auxiliary Space: O(26).
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/45fa306a9116332ece4cecdaedf50f140bd252d4/1
Powered by hirist.com
practice.geeksforgeeks.org
Balloon Everywhere | Practice | GeeksforGeeks
Bob is very fond of balloons. Once he visited an amusement park with his mother. The mother told Bob that she would buy him a balloon only if he answer her problem right. She gave Bob a string S [contains only lowercase characters] and aske
👍5
Must Learn!💡
Javascript is popularly known as the language used for web development, web applications, game development, etc. However, many find it tough, while it is smooth.
So, what are the fundamentals of using JavaScript?
This article will smoothly explain the most important information you should know about. Give it a read.
Link- https://www.geeksforgeeks.org/top-10-javascript-fundamentals-that-every-developer-should-know/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=javascriptfoundation
Javascript is popularly known as the language used for web development, web applications, game development, etc. However, many find it tough, while it is smooth.
So, what are the fundamentals of using JavaScript?
This article will smoothly explain the most important information you should know about. Give it a read.
Link- https://www.geeksforgeeks.org/top-10-javascript-fundamentals-that-every-developer-should-know/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=javascriptfoundation
👍1
🚨Job Alert🚨
Pensieve is hiring for Backend Developer.
Location - Remote (India)
Experience - 1-8 Years
Apply by - Feb 28, 2023
Apply via the following link and share the opportunity with your friends - https://practice.geeksforgeeks.org/jobs/Pensieveid_BackenDev
Visit our jobs portal 'Get Hired With GeeksforGeeks' for more such job opportunities - https://practice.geeksforgeeks.org/jobs
Pensieve is hiring for Backend Developer.
Location - Remote (India)
Experience - 1-8 Years
Apply by - Feb 28, 2023
Apply via the following link and share the opportunity with your friends - https://practice.geeksforgeeks.org/jobs/Pensieveid_BackenDev
Visit our jobs portal 'Get Hired With GeeksforGeeks' for more such job opportunities - https://practice.geeksforgeeks.org/jobs
Problem Of The Day
"Minimum Days"
Solve the problem to win points
Given a string S of length N containing only lowercase alphabets. You are also given a permutation P of length N containing integers from 0 to N-1. In (i+1)'th day you can take the P[i] value of the permutation array and replace S[P[i]] with a '?'.
For example in day 1, we can choose index of permutation array is i=0 and replace S[P[0]] with '?'.
Similarly in day 2, we can choose index of permutation array is i=1. You can replace S[P[1]] with '?'.
Similarly in day 3,we can choose index of permutation array is i=2. You can replace S[P[2]] with '?'.
You have to tell the minimum number of days required, such that after it for all index i (0<=i<N-1), if S[i]!='?', then S[i]!=S[i+1].
Example 1:
Input:
N = 4
S = "aabb"
P[] = {2, 1, 3, 0}
Output: 2
Explanation: In day 1, we replace S[P[0]] with '?'.
After that String S = "aa?b". As we can see S
still has character 'a' at index 0 and 1.
In day 2, we replace S[P[1]] with '?'. After
that String S = "a??b". As we can see the String
has for all index i (0<=i<N-1), if S[i]!='?', then S[i]!=S[i+1].
Example 2:
Input:
N = 4
S = "abca"
P[] = {3, 0, 2, 1}
Output: 0
Explanation: We can see that the initial string
S = "abca" has for all index i (0<=i<N-1), if S[i]!='?', then S[i]!=S[i+1].
Your Task:
You don't need to read input or print anything. Your task is to complete the function getMinimumDays() which takes the string S, array P[] and its size N as input parameters and returns the minimum number of days required such that string satisfies with the condition given earlier.
Expected Time Complexity: O(n).
Expected Auxiliary Space: O(1).
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/f4d22b1f9d62e8bee0ff84e9fa51dc66eb5005ec/1
Powered by hirist.com
"Minimum Days"
Solve the problem to win points
Given a string S of length N containing only lowercase alphabets. You are also given a permutation P of length N containing integers from 0 to N-1. In (i+1)'th day you can take the P[i] value of the permutation array and replace S[P[i]] with a '?'.
For example in day 1, we can choose index of permutation array is i=0 and replace S[P[0]] with '?'.
Similarly in day 2, we can choose index of permutation array is i=1. You can replace S[P[1]] with '?'.
Similarly in day 3,we can choose index of permutation array is i=2. You can replace S[P[2]] with '?'.
You have to tell the minimum number of days required, such that after it for all index i (0<=i<N-1), if S[i]!='?', then S[i]!=S[i+1].
Example 1:
Input:
N = 4
S = "aabb"
P[] = {2, 1, 3, 0}
Output: 2
Explanation: In day 1, we replace S[P[0]] with '?'.
After that String S = "aa?b". As we can see S
still has character 'a' at index 0 and 1.
In day 2, we replace S[P[1]] with '?'. After
that String S = "a??b". As we can see the String
has for all index i (0<=i<N-1), if S[i]!='?', then S[i]!=S[i+1].
Example 2:
Input:
N = 4
S = "abca"
P[] = {3, 0, 2, 1}
Output: 0
Explanation: We can see that the initial string
S = "abca" has for all index i (0<=i<N-1), if S[i]!='?', then S[i]!=S[i+1].
Your Task:
You don't need to read input or print anything. Your task is to complete the function getMinimumDays() which takes the string S, array P[] and its size N as input parameters and returns the minimum number of days required such that string satisfies with the condition given earlier.
Expected Time Complexity: O(n).
Expected Auxiliary Space: O(1).
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/f4d22b1f9d62e8bee0ff84e9fa51dc66eb5005ec/1
Powered by hirist.com
practice.geeksforgeeks.org
Minimum Days | Practice | GeeksforGeeks
Given a string S of length N containing only lowercase alphabets. You are also given a permutation P of length N containing integers from 0 to N-1. In (i+1)'th day you can take the P[i] value of the permutation array and replace S[P[i]] with a &#
🚨Job Alert🚨
JIT Inspire is hiring for React Developer.
Location - Rajiv Gandhi Square, Indore
Experience - 1-3 Years
Apply by - Feb 28, 2023
Apply via the following link and share the opportunity with your friends - https://practice.geeksforgeeks.org/jobs/JItInspire-REACT?utm_source=discord&utm_medium=marketingteam_gfgmain&utm_campaign=JItInspire-REACT
Visit our jobs portal 'Get Hired With GeeksforGeeks' for more such job opportunities - https://practice.geeksforgeeks.org/jobs
JIT Inspire is hiring for React Developer.
Location - Rajiv Gandhi Square, Indore
Experience - 1-3 Years
Apply by - Feb 28, 2023
Apply via the following link and share the opportunity with your friends - https://practice.geeksforgeeks.org/jobs/JItInspire-REACT?utm_source=discord&utm_medium=marketingteam_gfgmain&utm_campaign=JItInspire-REACT
Visit our jobs portal 'Get Hired With GeeksforGeeks' for more such job opportunities - https://practice.geeksforgeeks.org/jobs
❤1
Must Learn!💡
The process of discovering patterns and relationships in large datasets using machine learning and statistical analysis is called 'Data Mining'. It helps organizations keep a track of insights based on industry.
So, how is it done?
This article talks about data mining in detail. Give it a read.
Link - https://www.geeksforgeeks.org/what-is-data-mining-a-complete-beginners-guide/
The process of discovering patterns and relationships in large datasets using machine learning and statistical analysis is called 'Data Mining'. It helps organizations keep a track of insights based on industry.
So, how is it done?
This article talks about data mining in detail. Give it a read.
Link - https://www.geeksforgeeks.org/what-is-data-mining-a-complete-beginners-guide/
Problem Of The Day
"Prime List"
Solve the problem to win points
You are given the head of a linked list. You have to replace all the values of the nodes with the nearest prime number. If more than one prime number exists at an equal distance, choose the smallest one.
Example 1:
Input:
2 → 6 → 10
Output:
2 → 5 → 11
Explanation:
The nearest prime of 2 is 2 itself.
The nearest primes of 6 are 5 and 7,
since 5 is smaller so, 5 will be chosen.
The nearest prime of 10 is 11.
Example 2:
Input:
1 → 15 → 20
Output:
2 → 13 → 19
Explanation:
The nearest prime of 1 is 2.
The nearest primes of 15 are 13 and 17,
since 13 is smaller so, 13 will be chosen.
The nearest prime of 20 is 19.
Your Task:
The task is to complete the function primeList() which contains a reference to the head as the only argument. This function should return the head of the modified linked list.
Expected Time Complexity: O(number of nodes * sqrt(value of node)).
Expected Auxiliary Space: O(1).
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/6cb0782855c0f11445b8d70e220f888e6ea8e22a/1
Powered by hirist.com
"Prime List"
Solve the problem to win points
You are given the head of a linked list. You have to replace all the values of the nodes with the nearest prime number. If more than one prime number exists at an equal distance, choose the smallest one.
Example 1:
Input:
2 → 6 → 10
Output:
2 → 5 → 11
Explanation:
The nearest prime of 2 is 2 itself.
The nearest primes of 6 are 5 and 7,
since 5 is smaller so, 5 will be chosen.
The nearest prime of 10 is 11.
Example 2:
Input:
1 → 15 → 20
Output:
2 → 13 → 19
Explanation:
The nearest prime of 1 is 2.
The nearest primes of 15 are 13 and 17,
since 13 is smaller so, 13 will be chosen.
The nearest prime of 20 is 19.
Your Task:
The task is to complete the function primeList() which contains a reference to the head as the only argument. This function should return the head of the modified linked list.
Expected Time Complexity: O(number of nodes * sqrt(value of node)).
Expected Auxiliary Space: O(1).
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/6cb0782855c0f11445b8d70e220f888e6ea8e22a/1
Powered by hirist.com
practice.geeksforgeeks.org
Prime List | Practice | GeeksforGeeks
You are given the head of a linked list. You have to replace all the values of the nodes with the nearest prime number. If more than one prime number exists at an equal distance, choose the smallest one.
Example 1:
Input:
2 → 6 → 1
Example 1:
Input:
2 → 6 → 1
👍2
🚨Job Alert🚨
Plasma is hiring for Full Stack Developer.
Location - Noida
Experience - 3-6 Years
Apply by - Feb 28, 2023
Apply via the following link and share the opportunity with your friends - https://practice.geeksforgeeks.org/jobs/plasma-fullstack-devs-exp?utm_source=discord&utm_medium=marketingteam_gfgmain&utm_campaign=plasmafullstackdevsexp
Visit our jobs portal 'Get Hired With GeeksforGeeks' for more such job opportunities - https://practice.geeksforgeeks.org/jobs
Plasma is hiring for Full Stack Developer.
Location - Noida
Experience - 3-6 Years
Apply by - Feb 28, 2023
Apply via the following link and share the opportunity with your friends - https://practice.geeksforgeeks.org/jobs/plasma-fullstack-devs-exp?utm_source=discord&utm_medium=marketingteam_gfgmain&utm_campaign=plasmafullstackdevsexp
Visit our jobs portal 'Get Hired With GeeksforGeeks' for more such job opportunities - https://practice.geeksforgeeks.org/jobs
Must Learn!💡
We all use Instagram and who doesn't like to get likes, comments, and better reach on the platform? However, we struggle because we don't know the right upload time.
So, what is the best time to post on Instagram?
Don't worry! We got your back. This article will help you understand the same. Give it a read.
Link - https://www.geeksforgeeks.org/best-time-to-post-on-instagram/
We all use Instagram and who doesn't like to get likes, comments, and better reach on the platform? However, we struggle because we don't know the right upload time.
So, what is the best time to post on Instagram?
Don't worry! We got your back. This article will help you understand the same. Give it a read.
Link - https://www.geeksforgeeks.org/best-time-to-post-on-instagram/
Problem Of The Day
"Arithmetic Number"
Solve the problem to win points
Given three integers 'A' denoting the first term of an arithmetic sequence , 'C' denoting the common difference of an arithmetic sequence and an integer 'B'. you need to tell whether 'B' exists in the arithmetic sequence or not. Return 1 if B is present in the sequence. Otherwise, returns 0.
Example 1:
Input: A = 1, B = 3, C = 2
Output: 1
Explaination: 3 is the second term of the
sequence starting with 1 and having a common
difference 2.
Example 2:
Input: A = 1, B = 2, C = 3
Output: 0
Explaination: 2 is not present in the sequence.
Your Task:
You do not need to read input or print anything. Your task is to complete the function inSequence() which takes A, B and C and returns 1 if B is present in the sequence. Otherwise, returns 0.
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/arithmetic-number2815/1
Powered by hirist.com
"Arithmetic Number"
Solve the problem to win points
Given three integers 'A' denoting the first term of an arithmetic sequence , 'C' denoting the common difference of an arithmetic sequence and an integer 'B'. you need to tell whether 'B' exists in the arithmetic sequence or not. Return 1 if B is present in the sequence. Otherwise, returns 0.
Example 1:
Input: A = 1, B = 3, C = 2
Output: 1
Explaination: 3 is the second term of the
sequence starting with 1 and having a common
difference 2.
Example 2:
Input: A = 1, B = 2, C = 3
Output: 0
Explaination: 2 is not present in the sequence.
Your Task:
You do not need to read input or print anything. Your task is to complete the function inSequence() which takes A, B and C and returns 1 if B is present in the sequence. Otherwise, returns 0.
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/arithmetic-number2815/1
Powered by hirist.com
www.geeksforgeeks.org
Arithmetic Number | Practice | GeeksforGeeks
Given three integers 'A' denoting the first term of an arithmetic sequence , 'C' denoting the common difference of an arithmetic sequence and an integer 'B'. you need to tell whether 'B' exists in the arithm
👍2
Must Learn!💡
C++ is considered a powerful, versatile, and compiled language that means, source code is converted into machine language before execution.
So, how can you use C++ in much advanced manner?
This article talks about 10 tricks of C++ that you should know to enhance your programming skills. Give it a read.
Link- https://www.geeksforgeeks.org/10-cpp-programming-tricks-that-you-should-know/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=cppprogrammingtricks
C++ is considered a powerful, versatile, and compiled language that means, source code is converted into machine language before execution.
So, how can you use C++ in much advanced manner?
This article talks about 10 tricks of C++ that you should know to enhance your programming skills. Give it a read.
Link- https://www.geeksforgeeks.org/10-cpp-programming-tricks-that-you-should-know/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=cppprogrammingtricks
👍4
Problem Of The Day
"Walls Coloring"
Solve the problem to win points
There is a row of N walls in Geeksland. The king of Geeksland ordered Alexa to color all the walls on the occasion of New Year. Alexa can color each wall with either pink, black, or yellow. The cost associated with coloring each wall with a particular color is represented by a 2D array colors of size N*3 , where colors[i][0], colors[i][1], and colors[i][2] is the cost of painting ith wall with colors pink, black, and yellow respectively.
You need to find the minimum cost to color all the walls such that no two adjacent walls have the same color.
Example 1:
Input:
N = 3
colors[][] = {{14, 2, 11},
{11, 14, 5},
{14, 3, 10}}
Output:
10
Explanation:
Color wall 0 with black. Cost = 2.
Color wall 1 with yellow. Cost = 5.
Color wall 2 with black. Cost = 3.
Total Cost = 2 + 5 + 3 = 10
Example 2:
Input:
N = 2
colors[][] = {{1, 2, 3},
{1, 4, 6}}
Output:
3
Explanation:
Color wall 0 with black. Cost = 2
Color wall 1 with pink. Cost = 1
Total Cost = 1 + 2 = 3
Your Task:
Your task is to complete the function minCost() which takes the 2D integer array colors and an integer N as the input parameters and returns an integer, representing the minimum cost to color all the walls.
Expected Time Complexity: O(N).
Expected Auxiliary Space: O(N).
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/51b266505221b97522b1d2c86ddad1868a54831b/1
Powered by hirist.com
"Walls Coloring"
Solve the problem to win points
There is a row of N walls in Geeksland. The king of Geeksland ordered Alexa to color all the walls on the occasion of New Year. Alexa can color each wall with either pink, black, or yellow. The cost associated with coloring each wall with a particular color is represented by a 2D array colors of size N*3 , where colors[i][0], colors[i][1], and colors[i][2] is the cost of painting ith wall with colors pink, black, and yellow respectively.
You need to find the minimum cost to color all the walls such that no two adjacent walls have the same color.
Example 1:
Input:
N = 3
colors[][] = {{14, 2, 11},
{11, 14, 5},
{14, 3, 10}}
Output:
10
Explanation:
Color wall 0 with black. Cost = 2.
Color wall 1 with yellow. Cost = 5.
Color wall 2 with black. Cost = 3.
Total Cost = 2 + 5 + 3 = 10
Example 2:
Input:
N = 2
colors[][] = {{1, 2, 3},
{1, 4, 6}}
Output:
3
Explanation:
Color wall 0 with black. Cost = 2
Color wall 1 with pink. Cost = 1
Total Cost = 1 + 2 = 3
Your Task:
Your task is to complete the function minCost() which takes the 2D integer array colors and an integer N as the input parameters and returns an integer, representing the minimum cost to color all the walls.
Expected Time Complexity: O(N).
Expected Auxiliary Space: O(N).
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/51b266505221b97522b1d2c86ddad1868a54831b/1
Powered by hirist.com
practice.geeksforgeeks.org
Walls Coloring | Practice | GeeksforGeeks
There is a row of N walls in Geeksland. The king of Geeksland ordered Alexa to color all the walls on the occasion of New Year. Alexa can color each wall with either pink, black, or yellow. The cost associated with coloring each wall with a
👍1
Must Learn!💡
JavaScript is by far of the most popular languages when it comes to web development, powering most websites and web applications.
So, what are the code snippets you must know about JavaScript?
This article deals with the forementioned question in detail. Give it a read.
Link- https://www.geeksforgeeks.org/javascript-code-snippets-that-every-developer-must-know/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=javascriptcodesnippets
JavaScript is by far of the most popular languages when it comes to web development, powering most websites and web applications.
So, what are the code snippets you must know about JavaScript?
This article deals with the forementioned question in detail. Give it a read.
Link- https://www.geeksforgeeks.org/javascript-code-snippets-that-every-developer-must-know/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=javascriptcodesnippets
👍4
🚨Job Alert🚨
NCode Technologies is hiring for Laravel Developer.
Location - Ahmedabad, Gujarat
Experience - 2+ Years
Apply by - Feb 28, 2023
Apply via the following link and share the opportunity with your friends - https://practice.geeksforgeeks.org/jobs/NCode-Laravel?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=NCode-Laravel
Visit our jobs portal 'Get Hired With GeeksforGeeks' for more such job opportunities - https://practice.geeksforgeeks.org/jobs
NCode Technologies is hiring for Laravel Developer.
Location - Ahmedabad, Gujarat
Experience - 2+ Years
Apply by - Feb 28, 2023
Apply via the following link and share the opportunity with your friends - https://practice.geeksforgeeks.org/jobs/NCode-Laravel?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=NCode-Laravel
Visit our jobs portal 'Get Hired With GeeksforGeeks' for more such job opportunities - https://practice.geeksforgeeks.org/jobs
Problem Of The Day
"Geeks Island"
Solve the problem to win points
Geeks Island is represented by an N * M matrix mat. The island is touched by the Indian Ocean from the top and left edges and the Arabian Sea from the right and bottom edges. Each element of the matrix represents the height of the cell.
Due to the rainy season, the island receives a lot of rainfall, and the water can flow in four directions(up, down, left, or right) from one cell to another one with height equal or lower.
You need to find the number of cells from where water can flow to both the Indian Ocean and the Arabian Sea.
Example 1:
Input:
N = 5, M = 5
mat[][] = {{1, 3, 3, 2, 4},
{4, 5, 6, 4, 4},
{2, 4, 5, 3, 1},
{6, 7, 1, 4, 5},
{6, 1, 1, 3, 4}}
Output:
8
Explanation:
Indian ~ ~ ~ ~ ~
Ocean ~ 1 3 3 2 (4) *
~ 4 5 (6) (4) (4) *
~ 2 4 (5) 3 1 *
~ (6) (7) 1 4 5 *
~ (6) 1 1 3 4 *
* * * * * Arabian Sea
Water can flow to both ocean and sea from the cells
denoted by parantheses().For example at index(1,2), the height of that island is 6. If a water drop falls on that island, water can flow to up direction(as 3<=6) and reach to Indian Ocean. ALso, water can flow to right direction(as 6>=4>=4) and reach to Arabian Sea.
Example 2:
Input:
N = 3, M = 2
mat[][] = {{1, 1, 1},
{1, 1, 1}}
Output:
6
Explanation:
Water can flow from all cells to both Indian Ocean and Arabian Sea as the height of all islands are same.
Your Task:
Your task is to complete the function water_flow() which takes an integer array mat, integer N and integer M as the input parameter and returns an integer, denoting the number of cells from which water can to both ocean and sea.
Expected Time Complexity : O(N*M)
Expected Auxiliary Space : O(N*M)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/234ca3b438298fb04befd5abe7fbd98c006d4884/1
Powered by hirist.com
"Geeks Island"
Solve the problem to win points
Geeks Island is represented by an N * M matrix mat. The island is touched by the Indian Ocean from the top and left edges and the Arabian Sea from the right and bottom edges. Each element of the matrix represents the height of the cell.
Due to the rainy season, the island receives a lot of rainfall, and the water can flow in four directions(up, down, left, or right) from one cell to another one with height equal or lower.
You need to find the number of cells from where water can flow to both the Indian Ocean and the Arabian Sea.
Example 1:
Input:
N = 5, M = 5
mat[][] = {{1, 3, 3, 2, 4},
{4, 5, 6, 4, 4},
{2, 4, 5, 3, 1},
{6, 7, 1, 4, 5},
{6, 1, 1, 3, 4}}
Output:
8
Explanation:
Indian ~ ~ ~ ~ ~
Ocean ~ 1 3 3 2 (4) *
~ 4 5 (6) (4) (4) *
~ 2 4 (5) 3 1 *
~ (6) (7) 1 4 5 *
~ (6) 1 1 3 4 *
* * * * * Arabian Sea
Water can flow to both ocean and sea from the cells
denoted by parantheses().For example at index(1,2), the height of that island is 6. If a water drop falls on that island, water can flow to up direction(as 3<=6) and reach to Indian Ocean. ALso, water can flow to right direction(as 6>=4>=4) and reach to Arabian Sea.
Example 2:
Input:
N = 3, M = 2
mat[][] = {{1, 1, 1},
{1, 1, 1}}
Output:
6
Explanation:
Water can flow from all cells to both Indian Ocean and Arabian Sea as the height of all islands are same.
Your Task:
Your task is to complete the function water_flow() which takes an integer array mat, integer N and integer M as the input parameter and returns an integer, denoting the number of cells from which water can to both ocean and sea.
Expected Time Complexity : O(N*M)
Expected Auxiliary Space : O(N*M)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/234ca3b438298fb04befd5abe7fbd98c006d4884/1
Powered by hirist.com
practice.geeksforgeeks.org
Geeks Island | Practice | GeeksforGeeks
Geeks Island is represented by an N * M matrix mat. The island is touched by the Indian Ocean from the top and left edges and the Arabian Sea from the right and bottom edges. Each element of the matrix represents the height of the cell
👍1
Boom! Job-A-Thon 17 is here... 🙌
Give a boost to your career, participate and win your dream opportunities.
Opportunities are just a click away... 💫
Register now - https://practice.geeksforgeeks.org/contest/job-a-thon-17-hiring-challenge?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=jobathon17
Give a boost to your career, participate and win your dream opportunities.
Opportunities are just a click away... 💫
Register now - https://practice.geeksforgeeks.org/contest/job-a-thon-17-hiring-challenge?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=jobathon17
Must Learn!💡
Razorpay helps process online payments for online as well as offline businesses. Razor pay allows you to accept credit cards, debit cards, net banking, wallet, and UPI payments with the Mobile App integration.
So, how will you integrate it using flutter?
This article deals with aforementioned questions and talks about the implementation of a payment gateway in our Flutter app. Give it a read.
Link- https://www.geeksforgeeks.org/how-to-integrate-razorpay-payment-gateway-in-flutter/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=integraterazorpaypayment
Razorpay helps process online payments for online as well as offline businesses. Razor pay allows you to accept credit cards, debit cards, net banking, wallet, and UPI payments with the Mobile App integration.
So, how will you integrate it using flutter?
This article deals with aforementioned questions and talks about the implementation of a payment gateway in our Flutter app. Give it a read.
Link- https://www.geeksforgeeks.org/how-to-integrate-razorpay-payment-gateway-in-flutter/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=integraterazorpaypayment
👍1
Problem Of The Day
"Good Stones"
Solve the problem to win points
Geek is in a geekland which have a river and some stones in it. Initially geek can step on any stone. Each stone has a number on it representing the value of exact step geek can move. If the number is +ve then geeks can move right and if the number is -ve then geeks can move left. Bad Stones are defined as the stones in which if geeks steps, will reach a never ending loop whereas good stones are the stones which are safe from never ending loops. Return the number of good stones in river.
Example 1:
Input: [2, 3, -1, 2, -2, 4, 1]
Output: 3
Explanation: Index 3, 5 and 6 are safe only. As index 1, 4, 2 forms a cycle and from index 0 you can go to index 2 which is part of cycle.
Example 2:
Input: [1, 0, -3, 0, -5, 0]
Output: 2
Explanation: Index 2 and 4 are safe only. As index 0, 1, 3, 5 form cycle.
Your Task:
You don't need to read input or print anything. Your task is to complete the function badStones() which takes integer n and an array arr as input, and return an interger value as the number of good stones. Here n is the lenght of arr.
Expected Time Complexity : O(N), N is the number of stones
Expected Auxiliary Space : O(N), N is the number of stones
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/e2d156755ca4e0a9b9abf5680191d4b06e52b1a8/1
Powered by hirist.com
"Good Stones"
Solve the problem to win points
Geek is in a geekland which have a river and some stones in it. Initially geek can step on any stone. Each stone has a number on it representing the value of exact step geek can move. If the number is +ve then geeks can move right and if the number is -ve then geeks can move left. Bad Stones are defined as the stones in which if geeks steps, will reach a never ending loop whereas good stones are the stones which are safe from never ending loops. Return the number of good stones in river.
Example 1:
Input: [2, 3, -1, 2, -2, 4, 1]
Output: 3
Explanation: Index 3, 5 and 6 are safe only. As index 1, 4, 2 forms a cycle and from index 0 you can go to index 2 which is part of cycle.
Example 2:
Input: [1, 0, -3, 0, -5, 0]
Output: 2
Explanation: Index 2 and 4 are safe only. As index 0, 1, 3, 5 form cycle.
Your Task:
You don't need to read input or print anything. Your task is to complete the function badStones() which takes integer n and an array arr as input, and return an interger value as the number of good stones. Here n is the lenght of arr.
Expected Time Complexity : O(N), N is the number of stones
Expected Auxiliary Space : O(N), N is the number of stones
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/e2d156755ca4e0a9b9abf5680191d4b06e52b1a8/1
Powered by hirist.com
www.geeksforgeeks.org
Good Stones | Practice | GeeksforGeeks
Geek is in a geekland which have a river and some stones in it. Initially geek can step on any stone. Each stone has a number on it representing the value of exact step geek can move. If the number is +ve then geeks can move right and if the number i
👍1
The details of Job-A-Thon 17 is out....🙌
AdvaRisk is hiring for Junior Data Engineer.
Experience - 1+ Years
Location - Pune
Register now - https://practice.geeksforgeeks.org/jobs/AdvaRisk-Junior-Data-Engineer-Job-A-Thon?utm_sourc[…]rketingteam_gfgmain&utm_campaign=AdvaRiskjuniorjobathon
AdvaRisk is hiring for Junior Data Engineer.
Experience - 1+ Years
Location - Pune
Register now - https://practice.geeksforgeeks.org/jobs/AdvaRisk-Junior-Data-Engineer-Job-A-Thon?utm_sourc[…]rketingteam_gfgmain&utm_campaign=AdvaRiskjuniorjobathon