Tip 1 : Practice data structure questions
Tip 2 : Practice writing optimized solutions
Tip 1 : Keep the resume on paged and clean
Tip 2 : Highlight your experience and skills
Consider ARR = [1, 2, 3, 4, 4], the duplicate integer value present in the array is 4. Hence, the answer is 4 in this case.
A duplicate number is always present in the given array.
If no suggestions are found, return an empty 2D array.
In the above example everytime we enter a character, a few suggestions display the strings which contain the entered string as prefixes.
For ‘N’ = 6 and ‘EDGES’ = [ [0,1], [0, 2], [2, 3], [2, 4], [2, 5] ], see the below picture for reference:
1. For node 0:
a. Distance from node 0 to node 1 is 1.
b. Distance from node 0 to node 2 is 1.
c. Distance from node 0 to node 3 is 2.
d. Distance from node 0 to node 4 is 2.
e. Distance from node 0 to node 5 is 2.
So the sum of all the distances is 8.
2. For node 1:
a. Distance from node 1 to node 0 is 1.
b. Distance from node 1 to node 2 is 2.
c. Distance from node 1 to node 3 is 3.
d. Distance from node 1 to node 4 is 3.
e. Distance from node 1 to node 5 is 3.
So the sum of all the distances is 12.
3. For node 2:
a. Distance from node 2 to node 0 is 1.
b. Distance from node 2 to node 1 is 2.
c. Distance from node 2 to node 3 is 1.
d. Distance from node 2 to node 4 is 1.
e. Distance from node 2 to node 5 is 1.
So the sum of all the distances is 6.
4. For node 3:
a. Distance from node 3 to node 0 is 2.
b. Distance from node 3 to node 1 is 3.
c. Distance from node 3 to node 2 is 1.
d. Distance from node 3 to node 4 is 2.
e. Distance from node 3 to node 5 is 2.
So the sum of all the distances is 6.
5. For node 4:
a. Distance from node 4 to node 0 is 2.
b. Distance from node 4 to node 1 is 3.
c. Distance from node 4 to node 2 is 1.
d. Distance from node 4 to node 3 is 2.
e. Distance from node 4 to node 5 is 2.
So the sum of all the distances is 6.
6. For node 5:
a. Distance from node 5 to node 0 is 2.
b. Distance from node 5 to node 1 is 3.
c. Distance from node 5 to node 2 is 1.
d. Distance from node 5 to node 3 is 2.
e. Distance from node 5 to node 4 is 2.
So the sum of all the distances is 6.
So, ‘ANS’ for the above example will be [8, 12, 6, 10, 10, 10].
Previous company experience
Who is your role model?
What are your hobbies?
Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is the purpose of the < title > tag in HTML?