목록전체 글 (48)
킴의 레포지토리
문제 https://leetcode.com/problems/rotate-array/?envType=study-plan-v2&envId=top-interview-150 Rotate Array - LeetCode Can you solve this real interview question? Rotate Array - Given an integer array nums, rotate the array to the right by k steps, where k is non-negative. Example 1: Input: nums = [1,2,3,4,5,6,7], k = 3 Output: [5,6,7,1,2,3,4] Explanation: rotate 1 step leetcode.com Given an integ..
문제 https://leetcode.com/problems/majority-element/?envType=study-plan-v2&envId=top-interview-150 Given an array nums of size n, return the majority element. The majority element is the element that appears more than ⌊n / 2⌋ times. You may assume that the majority element always exists in the array. Example 1: Input: nums = [3,2,3] Output: 3 Example 2: Input: nums = [2,2,1,1,1,2,2] Output: 2 Cons..
문제 https://leetcode.com/problems/remove-duplicates-from-sorted-array-ii/ Given an integer array nums sorted in non-decreasing order, remove some duplicates in-place such that each unique element appears at most twice. The relative order of the elements should be kept the same. Since it is impossible to change the length of the array in some languages, you must instead have the result be placed i..