Leetcode 1162 As Far from Land as Possible Java O(MN) BFS while (size) loop not needed 7ms DP solution with example, beats 100%