[PS] Leet | 300. 가장 긴 증가 수열
·
CS/PS
문제Given an integer array nums, return the length of the longest strictly increasing subsequence.예시Example 1:Input: nums = [10,9,2,5,3,7,101,18] Output: 4 Explanation: The longest increasing subsequence is [2,3,7,101], therefore the length is 4.  Example 2:Input: nums = [0,1,0,3,2,3] Output: 4  Example 3:Input: nums = [7,7,7,7,7,7,7] Output: 1조건1 -104 답단조 증가하는 수열을 담을 리스트 incList를 새로 만들어 nums를 탐색합..
[PS] Leet | 322. 동전 교환
·
CS/PS
문제You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money. Return the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, return -1. You may assume that you have an infinite number of each kind of coin.예시Example 1:Input: coins =..
[PS] Leet | 11. 가장 큰 컨테이너
·
CS/PS
문제You are given an integer array height of length n. There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]). Find two lines that together with the x-axis form a container, such that the container contains the most water. Return the maximum amount of water a container can store. Notice that you may not slant the container.예시Exampe 1Input: height..
[PS] 같은 수의 뉴런
·
CS/PS
문제You are given a neural network with n layers. Each layer has a number of neurons represented by an array layer[], where layer[i] is the number of neurons in the i-th layer.The network undergoes updates in a sequence of generations. In each generation, you are allowed to increase the number of neurons in at most one layer, according to the following rules:In odd-numbered generations (1st, 3rd, ..
[PS] Leet | 15. 세 개의 합
·
CS/PS
문제Given an integer array nums, return all the triplets [nums[i], nums[j], nums[k]] such that i != j, i != k, and j != k, and nums[i] + nums[j] + nums[k] == 0. Notice that the solution set must not contain duplicate triplets.예시Example 1:Input: nums = [-1,0,1,2,-1,-4] Output: [[-1,-1,2],[-1,0,1]]Explanation:  nums[0] + nums[1] + nums[2] = (-1) + 0 + 1 = 0. nums[1] + nums[2] + nums[4] = 0 + 1 + (-1..
[PS] 가장 가까운 두 수
·
CS/PS
문제Given an array of distinct integers, determine the mininum absolute difference between any two elements, Print all element pairs with that difference in ascending order.예시Input : count = 4, numbers = [6,2,4,10]Output : [[2, 4], [4, 6]]Explanation : The minimum absolute difference is 2 and the pairs with that difference are (2, 4) and (4, 6). When printing element pairs (i,j), they should be or..
[PS] Leet | 33. 정렬된 회전 배열에서의 탐색
·
CS/PS
문제There is an integer array nums sorted in ascending order (with distinct values). Prior to being passed to your function, nums is possibly rotated at an unknown pivot index k (1 0-indexed). For example, [0,1,2,4,5,6,7] might be rotated at pivot index 3 and become [4,5,6,7,0,1,2]. Given the array nums after the possible rotation and an integer target, return the index of target if it is in nums,..
[PS] Leet | 153. 정렬된 회전배열에서의 최소값
·
CS/PS
문제Suppose an array of length n sorted in ascending order is rotated between 1 and n times.For example, the array nums = [0,1,2,4,5,6,7] might become: [4,5,6,7,0,1,2] if it was rotated 4 times. [0,1,2,4,5,6,7] if it was rotated 7 times. Notice that rotating an array [a[0], a[1], a[2], ..., a[n-1]] 1 time results in the array [a[n-1], a[0], a[1], a[2], ..., a[n-2]]. Given the sorted rotated array ..