Tip 1 : Be well versed with all the coding projects on your resume.
Tip 2 : Practice questions on the above mentioned topics from popular coding websites, like geegsforgeeks, interviewbit, etc, whichever suits you.
Tip 3 : Some courses like data structures and algorithms, if done, would be given more preference by interviewer over other candidates.
Tip 1 : Mention some good projects on your resume and be prepared.
Tip 2 : Do not put false things on your resume.



Let us suppose the numbers are chosen by participants: [2, 6, 5, 2, 3] and K = 3, then the distinct pairs having differences equal to K are: [2, 5] and [3, 6] so print 2.
The list of numbers can contain duplicate numbers, you need to print only the distinct pairs.
For example [2, 2, 3, 4] and K = 1, so you need to print 2 as the two distinct pairs are: (2, 3) and (3, 4).
I solved this question using the map in O(n) time complexity. First I stored the count of elements in an array then by checking the condition(k > 0 && map.containsKey(i + k) || k == 0 && map.get(i) > 1), I incremented the result by one every time when condition satisfied. Below is my code for the same.
class Solution {
public int findPairs(int[] nums, int k) {
Map map = new HashMap();
for(int num : nums)
map.put(num, map.getOrDefault(num, 0) + 1);
int result = 0;
for(int i : map.keySet())
if(k > 0 && map.containsKey(i + k) || k == 0 && map.get(i) > 1)
result++;
return result;
}
}



Let us say A = [2,4,6,7,6,9], then adjacent elements of sub array [6,7,6] have absolute difference of either 0 or 1 and this is the maximum length sub-array. So the required answer will be 3.
This was a simple array problem. I solved this using question as:
Starting from the first element of the array, find the first valid sub-array and store its length then starting from the next element (the first element that wasn’t included in the first sub-array), find another valid sub-array. Repeat the process until all the valid sub-arrays have been found then print the length of the maximum sub-array.

Here's your problem of the day
Solving this problem will increase your chance to get selected in this company
What is recursion?