[Easy] 191. Number of 1 Bits
leetCode 2022. 5. 24. 11:28

문제 Write a function that takes an unsigned integer and returns the number of '1' bits it has (also known as the Hamming weight). Note: Note that in some languages, such as Java, there is no unsigned integer type. In this case, the input will be given as a signed integer type. It should not affect your implementation, as the integer's internal binary representation is the same, whether it is sign..

[Medium] 120. Triangle
leetCode 2022. 5. 23. 21:31

문제 Given a triangle array, return the minimum path sum from top to bottom. For each step, you may move to an adjacent number of the row below. More formally, if you are on index i on the current row, you may move to either index i or index i + 1 on the next row. 예시 Example 1: Input: triangle = [[2],[3,4],[6,5,7],[4,1,8,3]] Output: 11 Explanation: The triangle looks like: 2 3 4 6 5 7 4 1 8 3 The ..

[Medium] 198. House Robber
leetCode 2022. 5. 23. 17:25

문제 You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security systems connected and it will automatically contact the police if two adjacent houses were broken into on the same night. Given an integer array nums representing the amount of mo..

[Easy] 70. Climbing Stairs
leetCode 2022. 5. 23. 15:52

문제 You are climbing a staircase. It takes n steps to reach the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? 예시 Example 1: Input: n = 2 Output: 2 Explanation: There are two ways to climb to the top. 1. 1 step + 1 step 2. 2 steps Example 2: Input: n = 3 Output: 3 Explanation: There are three ways to climb to the top. 1. 1 step + 1 step + 1 s..

[Medium] 784. Letter Case Permutation
leetCode 2022. 5. 19. 17:14

https://leetcode.com/problems/letter-case-permutation/ Letter Case Permutation - LeetCode Level up your coding skills and quickly land a job. This is the best place to expand your knowledge and get prepared for your next interview. leetcode.com 문제 Given a string s, you can transform every letter individually to be lowercase or uppercase to create another string. Return a list of all possible str..

[Medium] 46. Permutations
leetCode 2022. 5. 19. 14:26

문제 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],[3,1,2],[3,2,1]] Example 2: Input: nums = [0,1] Output: [[0,1],[1,0]] Example 3: Input: nums = [1] Output: [[1]] 제약 조건 Constraints: 1

[Medium] 77. Combinations
leetCode 2022. 5. 19. 11:56

문제 Given two integers n and k, return all possible combinations of k numbers out of the range [1, n]. You may return the answer in any order. 예시 Example 1: Input: n = 4, k = 2 Output: [ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4], ] Example 2: Input: n = 1, k = 1 Output: [[1]] 제약 조건 Constraints: 1

[Easy] 21. Merge Two Sorted Lists
leetCode 2022. 5. 18. 12:00

문제 You are given the heads of two sorted linked lists list1 and list2. Merge the two lists in a one sorted list. The list should be made by splicing together the nodes of the first two lists. Return the head of the merged linked list. 예시 Example 1: Input: list1 = [1,2,4], list2 = [1,3,4] Output: [1,1,2,3,4,4] Example 2: Input: list1 = [], list2 = [] Output: [] Example 3: Input: list1 = [], list2..