
알고리즘/문제풀이 2022. 7. 9.
[LeetCode] 88. Merge Sorted Array (Easy) 풀이
❓ 문제 You are given two integer arrays nums1 and nums2, sorted in non-decreasing order, and two integers m and n, representing the number of elements in nums1 and nums2 respectively. 내림차순으로 정렬된 두 개의 정수형 배열인 nums1 및 nums2와 nums1과 nums2의 element 수를 나타내는 두 개의 정수인 m, n가 주어진다. Merge nums1 and nums2 into a single array sorted in non-decreasing order. nums1과 nums2를 내림차순으로 정렬된 하나의 배열로 병합하려고 한다. The final..

알고리즘/문제풀이 2022. 7. 6.
[LeetCode] 70. Climbing Stairs (Easy) 풀이
❓ 문제 You are climbing a staircase. It takes n steps to reach the top. 계단을 올라가야한다. 계단 끝에 도달하기 위해 n 계단을 밟아야한다. Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top? 한번에 1계단 또는 2계단만 올라갈 수 있다. 계단 마지막으로 올라가기 위해서 중복 없이 얼마나 많은 경우의 수가 있는가? 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 Exampl..
