[Leetcode] 17. Letter Combinations of a Phone Number
·
코딩테스트/Python
🔗 Problem Link Letter Combinations of a Phone Number - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com ❔Thinking 2에서 9까지 숫자가 주어질 때, 각 숫자에 적힌 알파벳으로 가능한 조합을 모두 담은 리스트를 반환한다. 💻Solution 1. 조합을 활용한 풀이 from itertools import product def letterCombinations(self, digits: str) -> List[str]: ..
[Leetcode] 200. Number of Islands
·
코딩테스트/Python
🔗 Problem Link Number of Islands - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com ❔Thinking 0은 물, 1은 땅을 나타내는 grid가 주어질 때, 섬의 개수를 반환한다. 💻Solution 1. while을 활용한 DFS 풀이 def numIslands(grid: List[List[str]]) -> int: island = 0 m, n = len(grid), len(grid[0]) for i in range(m): for j in..