목록PS/LeetCode (591)
넘치게 채우기
https://leetcode.com/problems/ugly-number-ii/description/?envType=daily-question&envId=2024-08-18leetcode - Ugly Number II문제 유형 : 우선순위 큐, 수학, 구현문제 난이도 : Medium 문제An ugly number is a positive integer whose prime factors are limited to 2, 3, and 5.Given an integer n, return the nth ugly number. ugly number는 2,3,5만을 소인수로 갖는 양의 정수이다.n이 주어지면, n번째 ugly number를 구하시오. 풀이1은 2, 3, 5를 각각 0개씩 갖고 있는 양의 정수이므로..
https://leetcode.com/problems/maximum-number-of-points-with-cost/description/?envType=daily-question&envId=2024-08-17 leetcode - Maximum Number of Points with Cost문제 유형 : 다이나믹 프로그래밍문제 난이도 : Medium 문제You are given an m x n integer matrix points (0-indexed). Starting with 0 points, you want to maximize the number of points you can get from the matrix.To gain points, you must pick one cell in each ..
https://leetcode.com/problems/lemonade-change/description/?envType=daily-question&envId=2024-08-15leetcode - Lemonade Change문제 유형 : 그리디문제 난이도 : Easy 문제At a lemonade stand, each lemonade costs $5. Customers are standing in a queue to buy from you and order one at a time (in the order specified by bills). Each customer will only buy one lemonade and pay with either a $5, $10, or $20 bill. You must..
https://leetcode.com/problems/find-k-th-smallest-pair-distance/description/?envType=daily-question&envId=2024-08-14leetcode - Find K-th Smallest Pair Distance문제 유형 : 투 포인터, 이진탐색문제 난이도 : Hard 문제The distance of a pair of integers a and b is defined as the absolute difference between a and b.Given an integer array nums and an integer k, return the kth smallest distance among all the pairs nums[i] a..
https://leetcode.com/problems/combination-sum-ii/description/?envType=daily-question&envId=2024-08-13leetcode - Combination Sum II문제 유형 : 백트래킹, dfs, 재귀문제 난이도 : Medium 문제Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the candidate numbers sum to target.Each number in candidates may only be used once in the combin..
https://leetcode.com/problems/minimum-number-of-days-to-disconnect-island/description/leetcode - Minimum Number of Days to Disconnect Island문제 유형 : bfs / dfs, 그리디문제 난이도 : Hard 문제You are given an m x n binary grid grid where 1 represents land and 0 represents water. An island is a maximal 4-directionally (horizontal or vertical) connected group of 1's.The grid is said to be connected if we have e..
https://leetcode.com/problems/kth-largest-element-in-a-stream/description/?envType=daily-question&envId=2024-08-12leetcode = Kth Largest Element in a Stream문제 유형 : 우선순위 큐문제 난이도 : Easy 문제Design a class to find the kth largest element in a stream. Note that it is the kth largest element in the sorted order, not the kth distinct element.Implement KthLargest class:KthLargest(int k, int[] nums) Initi..
https://leetcode.com/problems/magic-squares-in-grid/description/?envType=daily-question&envId=2024-08-09leetcode - Magic Squares In Grid문제 유형 : 행렬문제 난이도 : Medium 문제A 3 x 3 magic square is a 3 x 3 grid filled with distinct numbers from 1 to 9 such that each row, column, and both diagonals all have the same sum.Given a row x col grid of integers, how many 3 x 3 contiguous magic square subgrids are..

https://leetcode.com/problems/spiral-matrix-iii/submissions/1348374879/leetcode - Spiral Matrix III문제 유형 : 행렬, 구현문제 난이도 : Medium 문제You start at the cell (rStart, cStart) of an rows x cols grid facing east. The northwest corner is at the first row and column in the grid, and the southeast corner is at the last row and column.You will walk in a clockwise spiral shape to visit every position in thi..

https://leetcode.com/problems/integer-to-english-words/description/?envType=daily-question&envId=2024-08-07leetcode - Integer to English Words문제 유형 : 문자열 처리문제 난이도 : Hard 문제Convert a non-negative integer num to its English words representation.음수가 아닌 정수 num을 영어 단어 표현으로 변환하여라. 풀이num의 각 자릿수들을 저장하기 위해, 10짜리 크기의 배열을 만들어서 저장한다.일의자릿수부터 잘라 넣어서, 역순으로 저장시켰다.예제를 보다보면, 규칙을 알 수 있다.바로, 세 자리 씩 끊어서 변환되어서 적절한 접미..