Tip 1 : Practice daily question of DS algo
Tip 2 : Prepare all your projects
Tip 3 : Daily practice of aptitude
Tip 4 : Practice previous years Company questions:
Tip 1 : Resume should contains only those skills that you know
Tip 2 : Add good projects and add github link to it also
Tip 3 : Resume should not be too long
Approach: The problem is similar to our old post “Segregate 0s and 1s in an array”.
The problem was posed with three colours, here `0′, `1′ and `2′. The array is divided into four sections:
a[1..Lo-1] zeroes (red)
a[Lo..Mid-1] ones (white)
a[Hi+1..N] twos (blue)
If the ith element is 0 then swap the element to the low range, thus shrinking the unknown ...
Traverse linked list using two-pointers. Move one pointer by one and the other pointers by two. When the fast pointer reaches the end, the slow pointer will reach the middle of the linked list.
A simple solution is to sort the given array using an O(N log N) sorting algorithm like Merge Sort, Heap Sort, etc, and return the element at index k-1 in the sorted array.
The Time Complexity of this solution is O(N log N)