Skip to content

Latest commit

 

History

History
15 lines (8 loc) · 495 Bytes

File metadata and controls

15 lines (8 loc) · 495 Bytes

As Far from Land as Possible

LeetCode #: 1162

Difficulty: Medium

Topic: Breadth-First Search, Graph.

Complexity Analysis

Assume n is the total number of cells in the input array.

Time complexity: O(n)

The solution will go through all the n cells twice. The first time is to get the initial list of lands. The second time is to perform breadth-first search based on the list of lands to get the maximum distance.