본문 바로가기

반응형

리트코드

(55)
[리트코드] 22. Generate Parentheses - js 1. 문제 https://leetcode.com/problems/generate-parentheses/description/ Generate Parentheses - LeetCode Can you solve this real interview question? Generate Parentheses - Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. Example 1: Input: n = 3 Output: ["((()))","(()())","(())()","()(())","()()()"] Exa leetcode.com 2. 코드 이 문제는 백트래킹을 활용하는 문제다. 백..
[리트코드] 206. Reverse Linked List - js 1. 문제 https://leetcode.com/problems/reverse-linked-list/ Reverse Linked List - LeetCode Can you solve this real interview question? Reverse Linked List - Given the head of a singly linked list, reverse the list, and return the reversed list. Example 1: [https://assets.leetcode.com/uploads/2021/02/19/rev1ex1.jpg] Input: head = [1,2,3,4,5] O leetcode.com 2. 코드 /** * Definition for singly-linked li..
[리트코드] 104. Maximum Depth of Binary Tree - js 1. 문제 https://leetcode.com/problems/maximum-depth-of-binary-tree/description/ Maximum Depth of Binary Tree - LeetCode Can you solve this real interview question? Maximum Depth of Binary Tree - Given the root of a binary tree, return its maximum depth. A binary tree's maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf leetcode.com 2. 코드 /** * ..
[리트코드] 94. Binary Tree Inorder Traversal - js 1. 문제 https://leetcode.com/problems/binary-tree-inorder-traversal/description/ Binary Tree Inorder Traversal - LeetCode Can you solve this real interview question? Binary Tree Inorder Traversal - Given the root of a binary tree, return the inorder traversal of its nodes' values. Example 1: [https://assets.leetcode.com/uploads/2020/09/15/inorder_1.jpg] Input: root = [1,nu leetcode.com 2. 코드 /** *..
[리트코드] 226. Invert Binary Tree - js 1. 문제 https://leetcode.com/problems/invert-binary-tree/description/ Invert Binary Tree - LeetCode Can you solve this real interview question? Invert Binary Tree - Given the root of a binary tree, invert the tree, and return its root. Example 1: [https://assets.leetcode.com/uploads/2021/03/14/invert1-tree.jpg] Input: root = [4,2,7,1,3,6,9] Output: [4 leetcode.com 2. 코드 /** * Definition for a bina..
[리트코드] 78. Subsets - js 1. 문제 https://leetcode.com/problems/subsets/description/ Subsets - LeetCode Can you solve this real interview question? Subsets - Given an integer array nums of unique elements, return all possible subsets (the power set). The solution set must not contain duplicate subsets. Return the solution in any order. Example 1: Input: n leetcode.com 2. 코드 /** * @param {number[]} nums * @return {number[][..
[리트코드] 46. Permutations - js 1. 문제 https://leetcode.com/problems/permutations/ Permutations - LeetCode Can you solve this real interview question? Permutations - Given an array nums of distinct integers, return all the possible permutations. You can return the answer in any order. Example 1: Input: nums = [1,2,3] Output: [[1,2,3],[1,3,2],[2,1,3],[2,3,1], leetcode.com 2. 코드 /** * @param {number[]} nums * @return {number[][]}..

반응형