Input: 'heights' = [[1, 8, 8],[3, 8, 9],[5,3,5]]
Output: 2
Explanation: The route of [1,3,5,3,5] has a maximum absolute difference of 2 in consecutive cells.
The first line contains two space-separated integers, 'rows' and 'columns'.
Next 'rows' lines contain 'columns' space-separated integers.
The only line contains the minimum time you require to travel from the top-left cell to the bottom-right cell.
The main idea here is to implement a dfs function with parameter TIME_LIMIT here: it is the maximum time you (as a ninja) can deal with. Then the idea is to use binary search to find the smallest TIME_LIMIT for which you can reach the ending point.
The algorithm will be-
The main idea here is to think about how the problem can be modelled as an undirected graph and solved using Dijkstra's algorithm using a breadth-first search fashion of cell (node) traversal.
The algorithm will be-
Distance to a Cycle in Undirected Graph
Find minimum
Search In A Sorted 2D Matrix
Day 28 : Fake Coin Problem
Day 28 : Fake Coin Problem
Search In A Rotated Sorted Array II