Tip 1 : Solve RS Aggarwal Aptitude and Problem Solving Books.
Tip 2 : Practice Coding questions from prepInsta.
Tip 3 : Worked on communication skills
Tip 1 : Mark skills with Bold letters.
Tip 2 : Mention projects on resume
If the given array is [1,2,3] then the answer would be 2. One of the ways to make all the elements of the given array equal is by adding 1 to the array element with value 1 and subtracting 1 from the array element with value 3. So that final array would become [2,2,2].
s1 - Test case 1: Choose i = 2 and split A[2] = 4 into X = 2, Y = 2 making A = [2, ,2, 2]. Now all elements of the array are equal.
s2 - Test case 2:
s3 - Choose i = 2 and split A[2] = 2 into X = 1, Y = 1 making A = [1, 3, 1, 1].
s4 - Choose i = 2 and split A[2] = 3 into X = 2, Y = 1 making A = [1, 1, 1, 2, 1].
Choose i = 4 and split A[4] = 2 into X = 1, Y = 1 making A = [1, 1, 1, 1, 1, 1]. Now all elements of the array are equal.
For 'N' = 5 and 'K' = 2
Let the cost of different candies in the store be: [9 8 2 6 4]
For the minimum amount:
Ram can buy a candy with cost 2 and take candies with costs 9 and 8 for free.
Then, he can buy a candy with cost 4 and take candy with cost 7 for free.
Thus, the minimum cost will be 6 i.e. 2 + 4.
For the maximum amount:
Ram can buy a candy with cost 9 and take candies with costs 2 and 6 for free.
Then, he can buy candy at cost 8 and take candy at cost 4 for free.
Thus, the minimum cost will be 17 i.e. 9 + 8.
Thus, Minimum = 6 and Maximum = 17.
s1 - sequence of N candies in the store
s2 - the i-th candy is denoted by Ai.
s3 - value of subarray AL, AL+1, ..., AR is defined as AL+AR
s4 - As the answer can be pretty large output it modulo 1000000007 (109+7)
Nodes are numbered from 0 to N - 1.
The graph given is connected.
Print the vertices in sorted order.
The following is an example of DAG i.e a directed graph with no cycles in it.
s1 : Add an edge between nodes 1 and 2 and another edge between nodes 1 and 3. Now the nodes 1, 2 and 3 form the largest component.
s2 : Nodes 2 and 3 are connected with an edge.
s3 : Add an edge between nodes 2 and 4. Now the nodes 2, 3 and 4 form the largest component.
s4 : Nodes 1 and 5 are connected with an edge.
s5 : Nodes 1 and 2 are connected with an edge.
s6 : Add an edge between nodes 4 and 5. Now the nodes 1, 2, 3, 4 and 5 form the largest component.
- Morning time
- Environment was good.
- No
- Interviewer was good
How would your current manager describe you?
What would you change about your current job description?
How do you stay organized in your current position?
Tell about a time when you made a mistake.
What did you do to fix it?
Tip 1 : Communication is must
Tip 2 : Practice more by Interview sites
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
Which array operation has O(n) worst-case time complexity?