본문 바로가기

🔥 PS(Problem Solving) 🔥122

[SQL] Leetcode | 178. Rank Scores 178. Rank Scores Medium Rank Scores - 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 순위 함수 DENSE_RANK() select score, `rank` from ( select score, DENSE_RANK() over (order by Score desc) as `rank` from Scores ) score_rank order by `rank`; 176 Second Highest Salary 를 풀고 나니 쉽게 풀 수 있던.. 2021. 7. 8.
[SQL] Leetcode | 176. Second Highest Salary 176. Second Highest Salary Easy Second Highest Salary - 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 문제 접근 두 번째로 높은 급여를 출력하는 문제였다. 문제는... 사람이 2명 미만일 때 null을 반환해야 한다. 처음 접근 했던 방법은 limit, offset 이었는데, 이 구문으로는 빈 배열을 반환한다. null을 반환하려면 함수를 거쳐야 하나..? null 다루는 방법을 못찾고 Discuss 탭에서 다른 방법.. 2021. 7. 7.
[Codility] Lesson 4 Counting Elements : MaxCounters 문제 MaxCounters coding task - Learn to Code - Codility Calculate the values of counters after applying all alternating operations: increase counter by 1; set value of all counters to current maximum. app.codility.com 결과 Test results - Codility You are given N counters, initially set to 0, and you have two possible operations on them: increase(X) − counter X is increased by 1, max counter − all co.. 2021. 4. 15.
[Codility] Lesson 4 Counting Elements : FrogRiverOne 문제 FrogRiverOne coding task - Learn to Code - Codility Find the earliest time when a frog can jump to the other side of a river. app.codility.com 결과 Test results - Codility A small frog wants to get to the other side of a river. The frog is initially located on one bank of the river (position 0) and wants to get to the opposite bank (position X+1). Leaves fall from a tree onto the surface of the.. 2021. 4. 7.
[Codility] Lesson 3 Time Complexity : TapeEquilibrium 문제 TapeEquilibrium coding task - Learn to Code - Codility Minimize the value |(A[0] + ... + A[P-1]) - (A[P] + ... + A[N-1])|. app.codility.com 결과 누적합 Test results - Codility A non-empty array A consisting of N integers is given. Array A represents numbers on a tape. Any integer P, such that 0 < P < N, splits this tape into two non-empty parts: A[0], A[1], ..., A[P − 1] and A[P], A[P + 1], ..., A.. 2021. 4. 6.
[Codility] Lesson 3 Time Complexity : PermMissingElem 문제 PermMissingElem coding task - Learn to Code - Codility Find the missing element in a given permutation. app.codility.com 결과 합 이용 Test results - Codility An array A consisting of N different integers is given. The array contains integers in the range [1..(N + 1)], which means that exactly one element is missing. Your goal is to find that missing element. Write a function: class Solution { publ.. 2021. 4. 6.
[Codility] Lesson 3 Time Complexity : FrogJmp 문제 FrogJmp coding task - Learn to Code - Codility Count minimal number of jumps from position X to Y. app.codility.com 결과 Test results - Codility A small frog wants to get to the other side of the road. The frog is currently located at position X and wants to get to a position greater than or equal to Y. The small frog always jumps a fixed distance, D. Count the minimal number of jumps that the .. 2021. 4. 5.
[Codility] Lesson 2 Arrays : OddOccurrencesInArray 문제 OddOccurrencesInArray coding task - Learn to Code - Codility Find value that occurs in odd number of elements. app.codility.com 결과 Test results - Codility A non-empty array A consisting of N integers is given. The array contains an odd number of elements, and each element of the array can be paired with another element that has the same value, except for one element that is left unpaired. For.. 2021. 4. 5.
[Codility] Lesson 2 Arrays : CyclicRotation 문제 CyclicRotation coding task - Learn to Code - Codility Rotate an array to the right by a given number of steps. app.codility.com 결과 int[] Test results - Codility An array A consisting of N integers is given. Rotation of the array means that each element is shifted right by one index, and the last element of the array is moved to the first place. For example, the rotation of array A = [3, 8, 9,.. 2021. 4. 2.