목록PS/LeetCode (587)
넘치게 채우기
https://leetcode.com/problems/minimum-number-of-moves-to-seat-everyone/description/leetcode - Minimum Number of Moves to Seat Everyone문제 유형 : 정렬, 그리디문제 난이도 : Easy 문제There are n seats and n students in a room. You are given an array seats of length n, where seats[i] is the position of the ith seat. You are also given the array students of length n, where students[j] is the position of the jth stu..
https://leetcode.com/problems/sort-colors/leetcode - Sort Colors문제 유형 : 정렬문제 난이도 : Medium 문제Given an array nums with n objects colored red, white, or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white, and blue.We will use the integers 0, 1, and 2 to represent the color red, white, and blue, respectively.You must solve this problem wi..
https://leetcode.com/problems/relative-sort-array/description/leetcode - Relative Sort Array문제 유형 : 정렬, 해시문제 난이도 : Easy 문제Given two arrays arr1 and arr2, the elements of arr2 are distinct, and all elements in arr2 are also in arr1.Sort the elements of arr1 such that the relative ordering of items in arr1 are the same as in arr2. Elements that do not appear in arr2 should be placed at the end of ..
https://leetcode.com/problems/height-checker/description/leetcode - Height Checker문제 유형 : 정렬문제 난이도 : Easy 문제A school is trying to take an annual photo of all the students. The students are asked to stand in a single file line in non-decreasing order by height. Let this ordering be represented by the integer array expected where expected[i] is the expected height of the ith student in line.You ar..
https://leetcode.com/problems/subarray-sums-divisible-by-k/description/leetcode - Subarray Sums Divisible by K문제 유형 : 부분합문제 난이도 : Medium 문제Given an integer array nums and an integer k, return the number of non-empty subarrays that have a sum divisible by k.A subarray is a contiguous part of an array. 정수배열 nums와 정수 k가 주어진다.길이가 1이상이며 합이 k의배수인 부분배열의 개수를 구하시오. 풀이부분합으로 값을 누적해서 풀어주면 된다.https://riverov..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/Okzwq/btsHThLkUTA/pk0KxZ0xHA0NNKcPtV7eAK/img.png)
https://leetcode.com/problems/continuous-subarray-sum/description/leetcode - Continuous Subarray Sum문제 유형 : 부분합, 수학문제 난이도 : Medium 문제Given an integer array nums and an integer k, return true if nums has a good subarray or false otherwise.A good subarray is a subarray where:its length is at least two, andthe sum of the elements of the subarray is a multiple of k.Note that:A subarray is a contiguo..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/bEjGsd/btsHRYZxxiR/KGKj0xlD0Ako8HDKdiKqd1/img.png)
https://leetcode.com/problems/replace-words/description/leetcode - Replace Words문제 유형 : 문자열 처리, 트라이(Trie)문제 난이도 : Medium 문제In English, we have a concept called root, which can be followed by some other word to form another longer word - let's call this word derivative. For example, when the root "help" is followed by the word "ful", we can form a derivative "helpful".Given a dictionary consisti..
https://leetcode.com/problems/hand-of-straights/description/leetcode - Hand of Straights문제 유형 : 우선순위 큐, 그리디, 해시문제 난이도 : Medium 문제Alice has some number of cards and she wants to rearrange the cards into groups so that each group is of size groupSize, and consists of groupSize consecutive cards.Given an integer array hand where hand[i] is the value written on the ith card and an integer groupSize,..
https://leetcode.com/problems/find-common-characters/description/ leetcode - Find Common Characters문제 유형 : 문자열 처리, 구현문제 난이도 : Easy 문제Given a string array words, return an array of all characters that show up in all strings within the words (including duplicates). You may return the answer in any order. 문자열 배열 words가 주어진다. words의 모든 문자들에서 겹치는 문자들을 찾아 반환하시오. 어떤 순서든 상관없습니다. 풀이freq(26,1e9) 배열을 만들어서 ..
https://leetcode.com/problems/longest-palindrome/description/?source=submission-noacleetcode - Longest Palindrome문제 유형 : 문자열 처리문제 난이도 : Easy 문제Given a string s which consists of lowercase or uppercase letters, return the length of the longest palindrome that can be built with those letters.Letters are case sensitive, for example, "Aa" is not considered a palindrome. 문자열 s가 주어집니다. 이들로 만들 수 있는 가장 ..