본문 바로가기

LeetCode3

[Python][LeetCode] letter Combinations of a phone number(전화번호 문자 조합) https://leetcode.com/problems/letter-combinations-of-a-phone-number/ 문제 설명: 2에서 9까지 숫자가 주어졌을 때 전화번호로 조합 가능한 모든 문자를 출력하는 문제 이 문제는 전체를 탐색해서 푸는 조합 문제이다. dic = { "2": "abc", "3": "def", "4": "ghi", "5": "jkl", "6": "mno", "7": "pqrs", "8": "tuv", "9": "wxyz", "0": "+" } 자판기에 다음과 같이 있다고 했을때 '23' 을 입력받으면 'ad' , 'ae', 'af', 'bd', 'be', 'bf', 'cd', 'cd', 'cf' 3*3 = 9개 출력을 하면 된다. 풀이 path = '' 를 정의하고 path.. 2024. 1. 17.
[LeetCode] Design Circular Queue(원형 큐 디자인) https://leetcode.com/problems/design-circular-queue/description/ Design Circular Queue - LeetCode Can you solve this real interview question? Design Circular Queue - Design your implementation of the circular queue. The circular queue is a linear data structure in which the operations are performed based on FIFO (First In First Out) principle, and the leetcode.com int Front() : 맨 앞 항목을 가져옵니다. 대기.. 2023. 10. 19.
Valid Parentheses https://leetcode.com/problems/valid-parentheses/ Valid Parentheses - LeetCode Can you solve this real interview question? Valid Parentheses - Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: 1. Open brackets must be closed by the sam leetcode.com 문제설명: 문자에 () [] {} 이렇게 제거해나가서 대칭이 모두 맞으면 true 대칭이 .. 2023. 10. 18.