417. Pacific Atlantic Water Flow
·
Algorithm/LeetCode
문제그래프 탐색 문제이다. 2차원 배열의 그래프가 주어진다. 그래프는 섬을 의미한다. 각 노드의 value는 섬의 높이다. 인근 노드와의 높이 차이로 물이 흐른다. 각 노드를 시작으로 물이 흐를 때 Pacific Ocean(태평양)과 Atlantic Ocean(대서양) 까지 닿는 노드들을 찾는 문제이다.링크: https://leetcode.com/problems/pacific-atlantic-water-flow/description/Solutionclass Solution { final int[][] d = {{-1, 0},{1, 0},{0, -1},{0, 1}}; public List> pacificAtlantic(int[][] heights) { int m = heights.l..