LeetCode 733 - Flood Fill (Easy)
๐ก ๋ฌธ์ LeetCode - 733๋ฒ ๐ฏ ํ์ด ๊ณผ์ BFS ๋ฅผ ์ด์ฉํด์ ๋๋ฌ ๊ฐ๋ฅํ ๋ชจ๋ ์ง์ ์ ํ์ธํ๋ ๋ฌธ์ ์
๋๋ค. ์ฌ๊ธฐ์ visit ์ด๋ผ๋ 2์ฐจ์ ๋ฐฐ์ด์ ์ ์งํ๋ฉฐ ์ค๋ณต ๋ฐฉ๋ฌธ์ ๊ฒ์ฌํจ๊ณผ ๋์์ ๋๋ฌ ๊ฐ๋ฅํ ์์น๋ฅผ ๊ธฐ๋กํฉ๋๋ค. ๐จ๐ป ์ฝ๋ /** * @param {number[][]} image * @param {number} sr * @param {number} sc * @param {number} newColor * @return {number[][]} */ var floodFill = function (image, sr, sc, newColor) { const dr = [0, 0, 1, -1] const dc = [1, -1, 0, 0] const [ROW, COL] = [image.length, ..
2022. 3. 7.