리트코드3 [LeetCode] 96. Unique Binary Search Trees Given an integer n, return the number of structurally unique BST's (binary search trees) which has exactly n nodes of unique values from 1 to n. Example 1: Input: n = 3 Output: 5 Example 2: Input: n = 1 Output: 1 Constraints: 1 int: if num == 0: return 1 else: return calcul(num - 1) * 2 * (2 * num + 1) // (num + 2) return calcul(n - 1) 문제 출처 : https://leetcode.com/problems/unique-binary-search-t.. 2023. 1. 15. [LeetCode] 91. Decode Ways A message containing letters from A-Z can be encoded into numbers using the following mapping: 'A' -> "1" 'B' -> "2" ... 'Z' -> "26" To decode an encoded message, all the digits must be grouped then mapped back into letters using the reverse of the mapping above (there may be multiple ways). For example, "11106" can be mapped into: "AAJF" with the grouping (1 1 10 6) "KJF" with the grouping (11 .. 2022. 12. 8. [LeetCode] 83. Remove Duplicates from Sorted List Given the head of a sorted linked list, delete all duplicates such that each element appears only once. Return the linked list sorted as well. Example 1: Input: head = [1,1,2] Output: [1,2] Example 2: Input: head = [1,1,2,3,3] Output: [1,2,3] Constraints: The number of nodes in the list is in the range [0, 300]. -100 2022. 10. 27. 이전 1 다음 반응형