[leetcode] 733. Flood Fill
문제 풀이 주어진 2차원 배열에서 상하좌우 4방향으로 시작위치의 색과 같은 색이면 새로운 색으로 칠하면 되는 문제이다. dfs, bfs 풀이로 풀면 된다. 처음에 아래와 같이 작성했다가 Time Limit Exceeded 나왔다. class Solution { fun floodFill(image: Array, sr: Int, sc: Int, newColor: Int): Array { val baseColor = image[sr][sc] fun fill(row: Int, col: Int) { if (row !in image.indices || col !in image[0].indices || image[row][col] != baseColor) { return } image[row][col] = newCo..