Find the kth largest element collectively from 2 sorted integer arrays.
Anonymous
Begin by comparing the two largest elements in the arrays. If you're looking for the largest, it will be the winner of this comparison. If you're looking for the kth largest you will decrement the index of the array containing the largest element and compare again using the largest of the 2nd array. Repeat this process in a loop while k > 1 and decrement k for every loop. Be careful to check that you're not going out of bounds in either array. If you do go out of bounds, you will simply decrement the index of the array until k = 0 (or k=1? not sure if I remember correctly). Also, do an initial check that the two arrays collectively have at least as many elements as the value k (you can't find the 11th smallest of 10 elements total). This will ensure that you don't go out of bounds when decrementing the array that has elements left over in it.
Check out your Company Bowl for anonymous work chats.