본문 바로가기
반응형

전체 글167

[LeetCode 해석 및 풀이] 22. Generate Parentheses LeetCode 문제 해석 및 풀이 방법 문제22. Generate Parentheses(괄호 생성) 바로가기 문제 설명 영문 Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. 한글 n쌍의 괄호가 주어지면, 모든 조합의 잘 만들어진 괄호형태를 생성하는 함수를 작성하시오. 제한조건 1 List[str]: if count == 0 == stack: return [state] result = [] if count > 0: result += get_next(state+'(', count-1, stack+1) if stack > 0: result += get_next(state+.. 2024. 4. 16.
[LeetCode 해석 및 풀이] 150. Evaluate Reverse Polish Notation LeetCode 문제 해석 및 풀이 방법 문제 150. Evaluate Reverse Polish Notation(역폴란드 표기법 계산) 바로가기 문제 설명 영문 You are given an array of strings tokens that represents an arithmetic expression in a Reverse Polish Notation. Evaluate the expression. Return an integer that represents the value of the expression. Note that: The valid operators are '+', '-', '*', and '/'. Each operand may be an integer or another expres.. 2024. 4. 16.
[LeetCode 해석 및 풀이] 155. Min Stack LeetCode 문제 해석 및 풀이 방법 문제 155. Min Stack(최소 스택) 바로가기 문제 설명 영문 Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. Implement the MinStack class MinStack() initializes the stack object. void push(int val) pushes the element val onto the stack. void pop() removes the element on the top of the stack. int top() gets the top element of the stack. int getMi.. 2024. 4. 16.
[LeetCode 해석 및 풀이] 20. Valid Parentheses LeetCode 문제 해석 및 풀이 방법 문제 20. Valid Parentheses(유효한 괄호) 바로가기 문제 설명 영문 Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. An input string is valid if: Open brackets must be closed by the same type of brackets. Open brackets must be closed in the correct order. Every close bracket has a corresponding open bracket of the same typ.. 2024. 4. 16.
[LeetCode 해석 및 풀이] 15. 3Sum LeetCode 문제 해석 및 풀이 방법 문제 15. 3Sum(3개의 합) 바로가기 문제 설명 영문 Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0. Notice that the solution set must not contain duplicate triplets. 한글 정수 배열 nums가 주어지면, i,j,k가 서로 다르고, nums[i] + nums[j] + nums[k] == 0가 되는 모든 트리플 [nums[i], nums[j], nums[k]]을 반환하세요. 답에는.. 2024. 4. 16.
[LeetCode 해석 및 풀이] 167. Two Sum II - Input Array Is Sorted LeetCode 문제 해석 및 풀이 방법 문제 167. Two Sum II - Input Array Is Sorted(두개의 합2 - 입력 배열이 정렬) 바로가기 문제 설명 영문 Given a 1-indexed array of integers numbers that is already sorted in non-decreasing order, find two numbers such that they add up to a specific target number. Let these two numbers be numbers[index1] and numbers[index2] where 1 2024. 4. 16.
반응형