[Leetcode] 46. Permutations
·
코딩테스트/Python
🔗 Problem Link Permutations - 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 주어진 숫자들을 모두 활용해 만들 수 있는 수열을 리스트에 담아 반환한다. 💻Solution 1. 조합을 활용한 풀이 from itertools import permutations def permute(self, nums): return list(permutations(nums, len(nums))) 2. DFS를 활용한 풀이 - 반복문 def ..
[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]: ..
[Programmers] Level 3. 불량 사용자
·
코딩테스트/Python
🔗 Problem Link 프로그래머스 코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요. programmers.co.kr ❔Thinking 일부 문자가 가려진 banned_id와 일치하는 user_id 목록을 만들고, 목록의 개수를 반환한다. 목록의 순서는 관계없으며, 목록의 아이디가 일치한다면 하나의 목록으로 간주한다. 💻Solution 1. id별 일치 여부를 확인하는 풀이 from itertools import permutations def IdCheck(uid, bid): if len(uid) != len(bid): return False correct_cnt = 0 for i in range(..