π¨ Job Alert π¨
Spyne is hiring for Technical Support.
Location - Gurgaon
Experience - Upto 2 Years
Apply by - April 30, 2023
Apply via the following link and share the opportunity with your friends- https://practice.geeksforgeeks.org/jobs/spyne-tech-support?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=spyne-tech-support
Spyne is hiring for Technical Support.
Location - Gurgaon
Experience - Upto 2 Years
Apply by - April 30, 2023
Apply via the following link and share the opportunity with your friends- https://practice.geeksforgeeks.org/jobs/spyne-tech-support?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=spyne-tech-support
π1
Problem Of The Day
"Maximum Length"
Solve the problem to win points
Given the maximum occurrences of a, b, and c in a string. Your task is to make the largest length string containing only a, b, and c such that no three consecutive characters are the same. Return the longest possible string length.
Example 1:
Input:
a = 3, b = 3, c = 3
Output:
9
Explanation:
No three consecutive character of
the string "abcabcabc" is same.
Example 2:
Input:
a = 11, b = 2, c = 2
Output:
-1
Explanation:
If we build a string of these character's,
the string will be"aabaacaabaacaaa", here
we can see that there will be three consecutive a. So
there is no solution exist.
Your Task:
You don't need to read input or print anything. Your task is to complete the function solve( ) which takes integers a, b, and c as input parameters and returns the longest possible string length. If there is no possible answer return -1.
Expected Time Complexity: O(a+b+c)
Expected Auxiliary Space: O(1)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/84963d7b5b84aa24f7807d86e672d0f97f41a4b5/1
Powered by hirist.com
"Maximum Length"
Solve the problem to win points
Given the maximum occurrences of a, b, and c in a string. Your task is to make the largest length string containing only a, b, and c such that no three consecutive characters are the same. Return the longest possible string length.
Example 1:
Input:
a = 3, b = 3, c = 3
Output:
9
Explanation:
No three consecutive character of
the string "abcabcabc" is same.
Example 2:
Input:
a = 11, b = 2, c = 2
Output:
-1
Explanation:
If we build a string of these character's,
the string will be"aabaacaabaacaaa", here
we can see that there will be three consecutive a. So
there is no solution exist.
Your Task:
You don't need to read input or print anything. Your task is to complete the function solve( ) which takes integers a, b, and c as input parameters and returns the longest possible string length. If there is no possible answer return -1.
Expected Time Complexity: O(a+b+c)
Expected Auxiliary Space: O(1)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/84963d7b5b84aa24f7807d86e672d0f97f41a4b5/1
Powered by hirist.com
practice.geeksforgeeks.org
Maximum Length | Practice | GeeksforGeeks
Given the maximum occurrences of a, b, and c in a string. Your task is to make the largest length string containing only a, b, and c such that no three consecutive characters are the same. Return the longest possible string length.
Example 1:
Example 1:
π3
Data Science is one of the trending career choices in recent times. Professionals in the field are called 'Data Scientists'.
A report suggests that this field has gained so much popularity that it is even considered the sexiest job of the 21st century.
So, what is the pay scale, what s are required, and what job roles a Data Scientist can hold? This article will tell you in detail. Give it a read.
Link- https://www.geeksforgeeks.org/data-scientist-salary-skills-and-job-roles/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=data-scientist-salary-skills-and-job-roles
A report suggests that this field has gained so much popularity that it is even considered the sexiest job of the 21st century.
So, what is the pay scale, what s are required, and what job roles a Data Scientist can hold? This article will tell you in detail. Give it a read.
Link- https://www.geeksforgeeks.org/data-scientist-salary-skills-and-job-roles/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=data-scientist-salary-skills-and-job-roles
Problem Of The Day
"Dominant Pairs"
Solve the problem to win points
You are given an array of integers of size n where n being even.. You have to calculate the number of dominate pairs (i,j) . Where a pair is called dominant if ( 0<=i<n/2, n/2<=j<n, arr[i]>=5*arr[j] ) these relation are fulfilled. For example in arr=[10,3,3,1] index i=0, j=3 form a dominating pair
Note : 0 based indexing is used and n is even
Example 1:
Input:
n=4
arr={10,2,2,1}
Output:
2
Explanation:
As we can see index i=0 and j=2 where
arr[0]>=5*arr[2] (10>=5*2)is fulfilled so
this forms a dominant pair and in same
manner index i=0 and j=3 forms dominant
pair.So total 2 dominant pairs.
Example 2:
Input:
n=6
arr={10,8,2,1,1,2}
Output:
5
Explanation:
As we can see index i=0 and j=3 where
arr[0]>=5*arr[3] (10>=5*1) is fulfilled so
this forms a dominant pair and in same
manner (0,4),(0,5),(1,3),(1,4) also form
dominant pair.So total 5 dominant pairs.
Your Task:
You don't need to read input or print anything. Your task is to complete the function dominantPairs() which takes an integer n and an array of integers arr respectively and returns the count of dominate pairs.
Expected Time Complexity: O(nlogn)
Expected Auxiliary Space: O(1)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/2a1c11024ceae36363fc405e07f2fa3e2f896ef0/1
Powered by hirist.com
"Dominant Pairs"
Solve the problem to win points
You are given an array of integers of size n where n being even.. You have to calculate the number of dominate pairs (i,j) . Where a pair is called dominant if ( 0<=i<n/2, n/2<=j<n, arr[i]>=5*arr[j] ) these relation are fulfilled. For example in arr=[10,3,3,1] index i=0, j=3 form a dominating pair
Note : 0 based indexing is used and n is even
Example 1:
Input:
n=4
arr={10,2,2,1}
Output:
2
Explanation:
As we can see index i=0 and j=2 where
arr[0]>=5*arr[2] (10>=5*2)is fulfilled so
this forms a dominant pair and in same
manner index i=0 and j=3 forms dominant
pair.So total 2 dominant pairs.
Example 2:
Input:
n=6
arr={10,8,2,1,1,2}
Output:
5
Explanation:
As we can see index i=0 and j=3 where
arr[0]>=5*arr[3] (10>=5*1) is fulfilled so
this forms a dominant pair and in same
manner (0,4),(0,5),(1,3),(1,4) also form
dominant pair.So total 5 dominant pairs.
Your Task:
You don't need to read input or print anything. Your task is to complete the function dominantPairs() which takes an integer n and an array of integers arr respectively and returns the count of dominate pairs.
Expected Time Complexity: O(nlogn)
Expected Auxiliary Space: O(1)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/2a1c11024ceae36363fc405e07f2fa3e2f896ef0/1
Powered by hirist.com
practice.geeksforgeeks.org
Dominant Pairs | Practice | GeeksforGeeks
You are given an array of integers of size n where n being even.. You have to calculate the number of dominate pairs (i,j) . Where a pair is called dominant if ( 0<=i<n/2, n/2<=j<n, arr[i]>=5*arr[j] ) these rel
π1
π¨ Job Alert π¨
NG-NEXT Tech is hiring for React Native Developer (iOS/Android).
Location - Bangalore
Experience - 1 - 3 Years
Apply by - April 30, 2023
Apply via the following link and share the opportunity with your friends- https://practice.geeksforgeeks.org/jobs/ngnexttech-react-native-devs?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=ngnexttech-react-native-devs
NG-NEXT Tech is hiring for React Native Developer (iOS/Android).
Location - Bangalore
Experience - 1 - 3 Years
Apply by - April 30, 2023
Apply via the following link and share the opportunity with your friends- https://practice.geeksforgeeks.org/jobs/ngnexttech-react-native-devs?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=ngnexttech-react-native-devs
Must Learn!π‘
This is the era of Artificial Intelligence (AI) and there are several tools that are ruling right now. ChatGPT is among them and better said, has changed the game.
However, there are rivals of the AI tool and that is Baiduβs Ernie AI chatbot which is also considered a revolutionizing chatbot.
Want to know more about this interesting chatbot and understand how Ernie is rivaling ChatGPT? This article will help you out! Give it a read.
Link- https://www.geeksforgeeks.org/what-is-ernie-ai-chatbot-and-how-it-is-rivaling-chatgpt/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=ernie-ai-chatbot
This is the era of Artificial Intelligence (AI) and there are several tools that are ruling right now. ChatGPT is among them and better said, has changed the game.
However, there are rivals of the AI tool and that is Baiduβs Ernie AI chatbot which is also considered a revolutionizing chatbot.
Want to know more about this interesting chatbot and understand how Ernie is rivaling ChatGPT? This article will help you out! Give it a read.
Link- https://www.geeksforgeeks.org/what-is-ernie-ai-chatbot-and-how-it-is-rivaling-chatgpt/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=ernie-ai-chatbot
π2
Problem Of The Day
"Partition the Array"
Solve the problem to win points
Given an array A[] of N integers. The task is to partition the array into four non-empty contiguous subarrays P, Q, R, and S such that each element of the array A[] should be present in exactly one subarray.
Let W, X, Y, and Z be the sum of the elements in P, Q, R, and S respectively.
Find the smallest absolute difference between the maximum and the minimum among W, X, Y, and Z.
Example 1:
Input:
N = 5
A[] = [4,2,2,5,1]
Output: 4
Explanation: let partition the array
P,Q,R,S = [4],[2,2],[5],[1]
W = 4, X = 4, Y = 5, Z = 1
Differnce = max(W,X,Y,Z)-min(W,X,Y,Z)= 5-1 = 4
Example 2:
Input:
N = 4
A[] = {4,4,4,4}
Output: 0
Explanation:
There is only one way to partition
the array. P,Q,R,S = [4],[4],[4],[4]
Your Task:
You don't need to read input or print anything. The task is to complete the function minDifference() which takes the integer N and the array A[] as inputs and returns the smallest absolute difference.
Expected Time Complexity: O(NLogN)
Expected Auxiliary Space: O(N)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/84912de770541b2a56bee869cf603fab990fd3e5/1
Powered by hirist.com
"Partition the Array"
Solve the problem to win points
Given an array A[] of N integers. The task is to partition the array into four non-empty contiguous subarrays P, Q, R, and S such that each element of the array A[] should be present in exactly one subarray.
Let W, X, Y, and Z be the sum of the elements in P, Q, R, and S respectively.
Find the smallest absolute difference between the maximum and the minimum among W, X, Y, and Z.
Example 1:
Input:
N = 5
A[] = [4,2,2,5,1]
Output: 4
Explanation: let partition the array
P,Q,R,S = [4],[2,2],[5],[1]
W = 4, X = 4, Y = 5, Z = 1
Differnce = max(W,X,Y,Z)-min(W,X,Y,Z)= 5-1 = 4
Example 2:
Input:
N = 4
A[] = {4,4,4,4}
Output: 0
Explanation:
There is only one way to partition
the array. P,Q,R,S = [4],[4],[4],[4]
Your Task:
You don't need to read input or print anything. The task is to complete the function minDifference() which takes the integer N and the array A[] as inputs and returns the smallest absolute difference.
Expected Time Complexity: O(NLogN)
Expected Auxiliary Space: O(N)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/84912de770541b2a56bee869cf603fab990fd3e5/1
Powered by hirist.com
practice.geeksforgeeks.org
Partition the Array | Practice | GeeksforGeeks
Given an array A[] of N integers. The task is to partition the array into four non-empty contiguous subarrays P, Q, R, and S such that each element of the array A[] should be present in exactly one subarray.
Let W, X, Y
Let W, X, Y
π2
The future is bright ahead!ππ€
Take up the challenge and make the best move for your career. Because we are here with exciting opportunities at Job-A-Thon 19.πΊ
Embrace your future by working with your dream organizations.πβ¨
Register Here: https://practice.geeksforgeeks.org/contest/job-a-thon-19-hiring-challenge?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=jobathon19
Take up the challenge and make the best move for your career. Because we are here with exciting opportunities at Job-A-Thon 19.πΊ
Embrace your future by working with your dream organizations.πβ¨
Register Here: https://practice.geeksforgeeks.org/contest/job-a-thon-19-hiring-challenge?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=jobathon19
Must Learn!π‘
ChatGPT has changed the game of the AI world. It recorded a whopping success since its release.
With ChatGPTβs megahit splash, Open AI has recently introduced its latest iteration, ' GPT 4β, which has become the most-talked-about launch in the tech world.
So, what is GPT-4? What new features does it have to offer? How to access GPT-4 for free?
This article will be your brief guide for Chat GPT and its latest model β ChatGPT-4. Give it a read.
Link- https://www.geeksforgeeks.org/how-to-use-chatgpt-4-for-free/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=chatgpt
ChatGPT has changed the game of the AI world. It recorded a whopping success since its release.
With ChatGPTβs megahit splash, Open AI has recently introduced its latest iteration, ' GPT 4β, which has become the most-talked-about launch in the tech world.
So, what is GPT-4? What new features does it have to offer? How to access GPT-4 for free?
This article will be your brief guide for Chat GPT and its latest model β ChatGPT-4. Give it a read.
Link- https://www.geeksforgeeks.org/how-to-use-chatgpt-4-for-free/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=chatgpt
π1
Problem Of The Day
"Remove the balls"
Solve the problem to win points
Imagine an imaginary array of length N containing balls. Given 2 arrays color and radius of length N each, where color[i] represents the color of the ith ball while radius[i] represents the radius of ith ball. If two consecutive balls have the same color and size, both are removed from the array. Geek wants to know the length of the final imaginary array.
Example 1:
Input:
N = 3
color[] = {2, 2, 5}
radius[] = {3, 3, 4}
Output:
1
Explanation:
First ball and second ball have same color 2 and
same radius 3.So,after removing only one ball
is left.It could not be removed from the array.
Hence, the final array has length 1.
Example 2:
Input:
N = 4
color[] = {1, 3, 3, 1}
radius[] = {2, 5, 5, 2}
Output:
0
Explanation:
Ball 2 and ball 3 have same color 3 and same radius
5.So,they are removed. Now, we have got our
color[]={1, 1} and radius[]={2, 2}.Both the left
balls are consecutive now and they are having
same color and radius. So,these two balls are
removed as well. Now,we are left with empty
final array. Hence, the length of final array is 0.
Your Task:
You don't need to read input or print anything. Your task is to complete the function finLength(), which takes integer N and array color[ ] and array radius[ ] as input parameters and returns the size of the final imaginary array.
Expected Time Complexity: O(n)
Expected Auxiliary Space: O(n)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/546ea68f97be7283a04ddcc8057e09b46a686471/1
Powered by hirist.com
"Remove the balls"
Solve the problem to win points
Imagine an imaginary array of length N containing balls. Given 2 arrays color and radius of length N each, where color[i] represents the color of the ith ball while radius[i] represents the radius of ith ball. If two consecutive balls have the same color and size, both are removed from the array. Geek wants to know the length of the final imaginary array.
Example 1:
Input:
N = 3
color[] = {2, 2, 5}
radius[] = {3, 3, 4}
Output:
1
Explanation:
First ball and second ball have same color 2 and
same radius 3.So,after removing only one ball
is left.It could not be removed from the array.
Hence, the final array has length 1.
Example 2:
Input:
N = 4
color[] = {1, 3, 3, 1}
radius[] = {2, 5, 5, 2}
Output:
0
Explanation:
Ball 2 and ball 3 have same color 3 and same radius
5.So,they are removed. Now, we have got our
color[]={1, 1} and radius[]={2, 2}.Both the left
balls are consecutive now and they are having
same color and radius. So,these two balls are
removed as well. Now,we are left with empty
final array. Hence, the length of final array is 0.
Your Task:
You don't need to read input or print anything. Your task is to complete the function finLength(), which takes integer N and array color[ ] and array radius[ ] as input parameters and returns the size of the final imaginary array.
Expected Time Complexity: O(n)
Expected Auxiliary Space: O(n)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/546ea68f97be7283a04ddcc8057e09b46a686471/1
Powered by hirist.com
practice.geeksforgeeks.org
Remove the balls | Practice | GeeksforGeeks
Imagine an imaginary array of length N containing balls. Given 2 arrays color and radius of length N each, where color[i] represents the color of the ith ball while radius[i] represents the radius of ith ball. If two consecutive balls
π3
We bet you don't wanna miss this opportunity!ππ€
Take up the challenge and make the best move for your career. Because we are here with exciting opportunities at Job-A-Thon 19.πΊ
Embrace your future by working with your dream organizations.πβ¨
Register here: https://practice.geeksforgeeks.org/jobs/Algocirrus-Salesforcetrainee-job-a-thon?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=Algocirrus-Salesforcetrainee-job-a-thon
Take up the challenge and make the best move for your career. Because we are here with exciting opportunities at Job-A-Thon 19.πΊ
Embrace your future by working with your dream organizations.πβ¨
Register here: https://practice.geeksforgeeks.org/jobs/Algocirrus-Salesforcetrainee-job-a-thon?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=Algocirrus-Salesforcetrainee-job-a-thon
Must Learn!π‘
Images and icons are the elements that drive emotional attachment to the content.
Good use of visual elements and a good user experience really enhance the overall good and feel.
So in this article, weβll be looking into some amazing concepts and ideas for using images, icons, and illustrations on the website/app.
Link- https://www.geeksforgeeks.org/understanding-the-use-of-images-icons-in-ui-design/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=use-of-images-icons-in-ui-design
Images and icons are the elements that drive emotional attachment to the content.
Good use of visual elements and a good user experience really enhance the overall good and feel.
So in this article, weβll be looking into some amazing concepts and ideas for using images, icons, and illustrations on the website/app.
Link- https://www.geeksforgeeks.org/understanding-the-use-of-images-icons-in-ui-design/?utm_source=telegram&utm_medium=marketingteam_gfgmain&utm_campaign=use-of-images-icons-in-ui-design
π2
Problem Of The Day
"Find Total Time Taken"
Solve the problem to win points
You are given an array arr of size n, containing the values in between 1 to n & time of size n, containg time in sec, you are asked to determine the total time taken in order to pick all the array elements from left to right but there is a condition, If from left, previous elments are different it takes 1 Sec to pick & if element got repeated then it will take time[arr[i]].
NOTE:
1. It takes 1 sec to move from index i to i+1 (1 <= i < n).
2. 1-based indexing.
Example 1:
Input:
n = 4
arr = {1, 2, 3, 3}
time = {1, 2, 3, 4}
Output:
5
Explanation:
for 1st element(1) = 0 Sec-> total = 0
2nd element(2) = 1 Sec-> total = 1+0=1
3rd element(3) = 1 Sec-> total = 1+1=2
4th element(3) : here element 3 is repeated
so we have to calculate time by time[arr[i]]
: time[arr[4]] => time[3] => 3 -> total = 2+3 =5
here you can see 4th element(3) is repeated
so time will be not 1 sec & we have to
calculate time by this: time[arr[i]].
Example 2:
Input:
n = 4
arr = {1, 2, 3, 4}
time = {1, 2, 3, 4}
Output:
3
Explanation:
for 1st element(1) = 0 Sec-> total = 0
2nd element(2) = 1 Sec-> total = 1
3rd element(3) = 1 Sec-> total = 2
4th element(4) = 1 Sec-> total = 3
here you can see no elements are repeated
so time will be 1 sec else will have to
calculate time by this: time[arr[i]].
Your Task:
You don't need to read input or print anything. Your task is to complete the function totalTime() which takes three variables n, arr, time, as explained in the problem statement, and returns the total time taken to pick all the elements.
Expected Time Complexity: O(n)
Expected Auxiliary Space: O(n)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/5ae4f296db3e6bb74641c4087d587b6f89d9d135/1
Powered by hirist.com
"Find Total Time Taken"
Solve the problem to win points
You are given an array arr of size n, containing the values in between 1 to n & time of size n, containg time in sec, you are asked to determine the total time taken in order to pick all the array elements from left to right but there is a condition, If from left, previous elments are different it takes 1 Sec to pick & if element got repeated then it will take time[arr[i]].
NOTE:
1. It takes 1 sec to move from index i to i+1 (1 <= i < n).
2. 1-based indexing.
Example 1:
Input:
n = 4
arr = {1, 2, 3, 3}
time = {1, 2, 3, 4}
Output:
5
Explanation:
for 1st element(1) = 0 Sec-> total = 0
2nd element(2) = 1 Sec-> total = 1+0=1
3rd element(3) = 1 Sec-> total = 1+1=2
4th element(3) : here element 3 is repeated
so we have to calculate time by time[arr[i]]
: time[arr[4]] => time[3] => 3 -> total = 2+3 =5
here you can see 4th element(3) is repeated
so time will be not 1 sec & we have to
calculate time by this: time[arr[i]].
Example 2:
Input:
n = 4
arr = {1, 2, 3, 4}
time = {1, 2, 3, 4}
Output:
3
Explanation:
for 1st element(1) = 0 Sec-> total = 0
2nd element(2) = 1 Sec-> total = 1
3rd element(3) = 1 Sec-> total = 2
4th element(4) = 1 Sec-> total = 3
here you can see no elements are repeated
so time will be 1 sec else will have to
calculate time by this: time[arr[i]].
Your Task:
You don't need to read input or print anything. Your task is to complete the function totalTime() which takes three variables n, arr, time, as explained in the problem statement, and returns the total time taken to pick all the elements.
Expected Time Complexity: O(n)
Expected Auxiliary Space: O(n)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/5ae4f296db3e6bb74641c4087d587b6f89d9d135/1
Powered by hirist.com
practice.geeksforgeeks.org
Find Total Time Taken | Practice | GeeksforGeeks
You are given an array arr of size n, containing the values in between 1 to n, you are asked to determine the total time taken in order to pick all the array elements from left to right but there is a condition, you are also given an another array ti
π3
Must Learn!π‘
Getting stressed about failure is quite natural and is completely normal.
But, often degrading your talents and abilities irrespective of what other people think of you is a sign of a mental illness. This is described as imposter syndrome.
This article will help you learn about the categories of imposter syndrome and how can one overcome it.
Link- https://www.geeksforgeeks.org/ways-to-deal-with-imposter-syndrome-and-achieve-success-a[β¦]m_gfgmain&utm_campaign=ways-to-deal-with-imposter-syndrome
Getting stressed about failure is quite natural and is completely normal.
But, often degrading your talents and abilities irrespective of what other people think of you is a sign of a mental illness. This is described as imposter syndrome.
This article will help you learn about the categories of imposter syndrome and how can one overcome it.
Link- https://www.geeksforgeeks.org/ways-to-deal-with-imposter-syndrome-and-achieve-success-a[β¦]m_gfgmain&utm_campaign=ways-to-deal-with-imposter-syndrome
π2π₯°1
Problem Of The Day
"Unequal Arrays"
Solve the problem to win points
You are given two arrays A and B each of length N. You can perform the following operation on array A zero or more times.
Select any two indices i and j, 1 <= i , j <= N and i != j
Set A[i] = A[i] + 2 and A[j] = A[j]-2
Find the minimum number of operations required to make A and B equal.
Note :
Two arrays are said to be equal if the frequency of each element is equal in both of them.
Arrays may contain duplicate elements.
Example 1:
Input:
N = 3
A[] = {2, 5, 6}
B[] = {1, 2, 10}
Output: 2
Explanation:
Select i = 3, j = 2, A[3] = 6 + 2 = 8 and A[2] = 5 - 2 = 3
Select i = 3, j = 2, A[3] = 8 + 2 = 10 and A[2] = 3 - 2 = 1
Now A = {2, 1, 10} and B = {1, 2, 10}
Example 2:
Input:
N = 2
A[] = {3, 3}
B[] = {9, 8}
Output: -1
Explanation:
It can be shown that A cannot be made equal to B.
Your Task:
You don't need to read input or print anything. Your task is to complete the function solve() which takes the 2 arrays A[], B[] and their size N as input parameters and returns the minimum number of moves to make A and B equal if possible else return -1.
Expected Time Complexity: O(NlogN)
Expected Auxiliary Space: O(N)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/4db2fcd97400456c4914d5a3e8ad932cc21e3e9d/1
Powered by hirist.com
"Unequal Arrays"
Solve the problem to win points
You are given two arrays A and B each of length N. You can perform the following operation on array A zero or more times.
Select any two indices i and j, 1 <= i , j <= N and i != j
Set A[i] = A[i] + 2 and A[j] = A[j]-2
Find the minimum number of operations required to make A and B equal.
Note :
Two arrays are said to be equal if the frequency of each element is equal in both of them.
Arrays may contain duplicate elements.
Example 1:
Input:
N = 3
A[] = {2, 5, 6}
B[] = {1, 2, 10}
Output: 2
Explanation:
Select i = 3, j = 2, A[3] = 6 + 2 = 8 and A[2] = 5 - 2 = 3
Select i = 3, j = 2, A[3] = 8 + 2 = 10 and A[2] = 3 - 2 = 1
Now A = {2, 1, 10} and B = {1, 2, 10}
Example 2:
Input:
N = 2
A[] = {3, 3}
B[] = {9, 8}
Output: -1
Explanation:
It can be shown that A cannot be made equal to B.
Your Task:
You don't need to read input or print anything. Your task is to complete the function solve() which takes the 2 arrays A[], B[] and their size N as input parameters and returns the minimum number of moves to make A and B equal if possible else return -1.
Expected Time Complexity: O(NlogN)
Expected Auxiliary Space: O(N)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/4db2fcd97400456c4914d5a3e8ad932cc21e3e9d/1
Powered by hirist.com
practice.geeksforgeeks.org
Unequal Arrays | Practice | GeeksforGeeks
You are given two arrays A and B each of length N. You can perform the following operation on array A zero or more times.
Select any two indices i and j, 1 <= i , j <= N and i != j
Set A[i] = A[i] + 2 and A[j] = A[j
Select any two indices i and j, 1 <= i , j <= N and i != j
Set A[i] = A[i] + 2 and A[j] = A[j
π2
This is the opportunity that you have been waiting for!ππ€
Take up the challenge and make the best move for your career. Because we are here with exciting opportunities at Job-A-Thon 19.πΊ
Embrace your future by working with your dream organizations.πβ¨
Register Here: https://practice.geeksforgeeks.org/jobs/InfrrdPvtLtd-job-a-thon
Take up the challenge and make the best move for your career. Because we are here with exciting opportunities at Job-A-Thon 19.πΊ
Embrace your future by working with your dream organizations.πβ¨
Register Here: https://practice.geeksforgeeks.org/jobs/InfrrdPvtLtd-job-a-thon
β€1
Must Learn!π‘
Youβve certainly yearned for a relatively good memory if youβve ever forgotten where you put your keys or forgotten crucial facts on an examination.
Luckily, there are a few activities you may engage in to enhance your memory. You may prevent memory loss and generally improve your memory by doing the following thing.
This article will help you understand best ways to boost your memory. Give it a read.
Link- https://www.geeksforgeeks.org/scientific-ways-to-boost-your-memory-learn-anything-faste[β¦]_gfgmain&utm_campaign=scientific-ways-to-boost-your-memory
Youβve certainly yearned for a relatively good memory if youβve ever forgotten where you put your keys or forgotten crucial facts on an examination.
Luckily, there are a few activities you may engage in to enhance your memory. You may prevent memory loss and generally improve your memory by doing the following thing.
This article will help you understand best ways to boost your memory. Give it a read.
Link- https://www.geeksforgeeks.org/scientific-ways-to-boost-your-memory-learn-anything-faste[β¦]_gfgmain&utm_campaign=scientific-ways-to-boost-your-memory
π6β€1
Problem Of The Day
"Job Sequencing Problem"
Solve the problem to win points
Given a set of N jobs where each jobi has a deadline and profit associated with it. Each job takes 1 unit of time to complete and only one job can be scheduled at a time. We earn the profit if and only if the job is completed by its deadline. The task is to find the number of jobs done and the maximum profit.
Note: Jobs will be given in the form (Jobid, Deadline, Profit) associated with that Job.
Example 1:
Input:
N = 4
Jobs = {(1,4,20),(2,1,10),(3,1,40),(4,1,30)}
Output:
2 60
Explanation:
Job1 and Job3 can be done with
maximum profit of 60 (20+40).
Example 2:
Input:
N = 5
Jobs = {(1,2,100),(2,1,19),(3,2,27),
(4,1,25),(5,1,15)}
Output:
2 127
Explanation:
2 jobs can be done with
maximum profit of 127 (100+27).
Your Task :
You don't need to read input or print anything. Your task is to complete the function JobScheduling() which takes an integer N and an array of Jobs(Job id, Deadline, Profit) as input and returns an array ans[ ] in which ans[0] contains the count of jobs and ans[1] contains maximum profit.
Expected Time Complexity: O(NlogN)
Expected Auxilliary Space: O(N)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/00ae30d0e0f6d8877c68f8b8558c5b0138fdb4b7/1
Powered by hirist.com
"Job Sequencing Problem"
Solve the problem to win points
Given a set of N jobs where each jobi has a deadline and profit associated with it. Each job takes 1 unit of time to complete and only one job can be scheduled at a time. We earn the profit if and only if the job is completed by its deadline. The task is to find the number of jobs done and the maximum profit.
Note: Jobs will be given in the form (Jobid, Deadline, Profit) associated with that Job.
Example 1:
Input:
N = 4
Jobs = {(1,4,20),(2,1,10),(3,1,40),(4,1,30)}
Output:
2 60
Explanation:
Job1 and Job3 can be done with
maximum profit of 60 (20+40).
Example 2:
Input:
N = 5
Jobs = {(1,2,100),(2,1,19),(3,2,27),
(4,1,25),(5,1,15)}
Output:
2 127
Explanation:
2 jobs can be done with
maximum profit of 127 (100+27).
Your Task :
You don't need to read input or print anything. Your task is to complete the function JobScheduling() which takes an integer N and an array of Jobs(Job id, Deadline, Profit) as input and returns an array ans[ ] in which ans[0] contains the count of jobs and ans[1] contains maximum profit.
Expected Time Complexity: O(NlogN)
Expected Auxilliary Space: O(N)
Solve and submit your answer here : https://practice.geeksforgeeks.org/problems/00ae30d0e0f6d8877c68f8b8558c5b0138fdb4b7/1
Powered by hirist.com
practice.geeksforgeeks.org
Job Sequencing Problem | Practice | GeeksforGeeks
Given a set of N jobs where each jobi has a deadline and profit associated with it. Each job takes 1 unit of time to complete and only one job can be scheduled at a time. We earn the profit if and only if the job is completed by its deadline. Th
π2
We bet you don't wanna miss this opportunity!ππ€
Take up the challenge and make the best move for your career. Because we are here with exciting opportunities at Job-A-Thon 19.πΊ
Embrace your future by working with your dream organizations.πβ¨
Register Here: https://practice.geeksforgeeks.org/jobs/Finolity-trainee-Job-a-thon19
Take up the challenge and make the best move for your career. Because we are here with exciting opportunities at Job-A-Thon 19.πΊ
Embrace your future by working with your dream organizations.πβ¨
Register Here: https://practice.geeksforgeeks.org/jobs/Finolity-trainee-Job-a-thon19
π1