Skip to content
Advertisement

Tag: algorithm

Kth Smallest Element in multiple sorted arrays

Let’s say we have two arrays: array1 = [2,3,6,7,9] array2 = [1,4,8,10] I understood how to find the kth element of two sorted arrays in log(min(m,n)) where m is the length of array1 and n is the length of array2 as follows: But I couldn’t figure out how to extend this to multiple sorted arrays case. For example, given 3

Finding the coordinates of max sum path in matrix

I have this method which returns the max sum of the path from top left to bottom right (can move only to the right or bottom). output : 1 + 3 + 4 + 5 = 13 But what I want to get is also the coordinates of the points of the path: [(0,0) (1,0) (1,1) (1,2)] Answer The variable

Advertisement