본문 바로가기
반응형

DP3

괄호를 추가하는 서로 다른 방법 서론 ❔ 문제 Leetcode 241, Different Ways to Add Parentheses 문제이다. 아래는 leetcode의 링크이다. https://leetcode.com/problems/different-ways-to-add-parentheses/ Given a string expression of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. You may return the answer in any order. 숫자와 연산자로 이루어진 스트링 형식의 수식이 주어지면, 숫자와 연산자를 묶을 수 있는 모든 .. 2022. 1. 29.
복호화 방법 서론 ❔문제 Leetcode 91번, Decode Ways 문제이다. 아래는 leetcode의 링크이다. https://leetcode.com/problems/decode-ways/ A-Z 를 포함하는 메시지는 다음과 같이 대응되어 암호화 될 수 있다. 'A' -> "1" 'B' -> "2" ... 'Z' -> "26" 암호화 된 메시지는 위와 같은 매핑의 반대로 다시 복호화 될 수 있다.(여러 방법이 있을 수 있다.) 예를 들어 "11106"의 경우 아래와 같이 복호화 될 수 있다. "AAJF" with the grouping (1 1 10 6) "KJF" with the grouping (11 10 6) (11 1 06) 의 경우 06은 6과 다르기 때문에 .. 2022. 1. 20.
모든 가능한 괄호의 조합 찾기 서론 ❔문제 Leetcode 22번, Generate Parentheses 문제이다. 아래는 leetcode의 링크이다. https://leetcode.com/problems/generate-parentheses/ n 쌍의 괄호가 주어졌을때 잘 만들어진 모든 괄호들의 조합을 생성하는 함수를 작성하시오. 테스트 케이스는 다음과 같다. Input: n = 3 Output: ["((()))","(()())","(())()","()(())","()()()"] Input: n = 1 Output: ["()"] n의 범위는 아래와 같다. 1 2022. 1. 20.
반응형