본문 바로가기

Algorithm

(2139)
(C++) - LeetCode (easy) 1331. Rank Transform of an Array https://leetcode.com/problems/rank-transform-of-an-array/description/ LeetCode - The World's Leading Online Programming Learning Platform 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 여러 자료구조를 사용해 푼 문제였습니다. 📕 풀이방법 📔 입력 및 초기화 1. 더 큰 원소가 queue front에 오도록 priority_queue pq를 선언 후 arr의 원소를 삽입합..
(SQL) - LeetCode (easy) 1327. List the Products Ordered in a Period https://leetcode.com/problems/list-the-products-ordered-in-a-period/description/ LeetCode - The World's Leading Online Programming Learning Platform 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 join, group by, 조건절을 사용해본 문제였습니다. 📕 풀이방법 📔 풀이과정 1. products와 orders를 product_id에 대해 join합니다.2...
(C++) - LeetCode (easy) 1323. Maximum 69 Number https://leetcode.com/problems/maximum-69-number/description/ LeetCode - The World's Leading Online Programming Learning Platform 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 간단 구현 문제였습니다. 📕 풀이방법 📔 입력 및 초기화 num을 문자열로 바꿔서 numString에 저장해줍니다. 📔 풀이과정 가장 큰 수를 만드는 법은 6이 처음나온 부분을 9로 바꿔준 후 numStr..
(C++) - LeetCode (easy) 1317. Convert Integer to the Sum of Two No-Zero Integers https://leetcode.com/problems/convert-integer-to-the-sum-of-two-no-zero-integers/description/ LeetCode - The World's Leading Online Programming Learning Platform 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 간단 구현 문제였습니다. 📕 풀이방법 📔 풀이과정 1 ~ n/2까지 for loop를 수행하면서 i 와 n - i에 0이 포함되어있는지 확인해 정..
(C++) - LeetCode (easy) 1313. Decompress Run-Length Encoded List https://leetcode.com/problems/decompress-run-length-encoded-list/ LeetCode - The World's Leading Online Programming Learning Platform 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 간단 구현 문제였습니다. 📕 풀이방법 📔 입력 및 초기화 정답 vector ans를 선언해줍니다. 📔 풀이과정 nums의 원소를 순회하며 freq와 val을 저장해 freq만큼 val을 ans에 ..
(C++) - LeetCode (easy) 1309. Decrypt String from Alphabet to Integer Mapping https://leetcode.com/problems/decrypt-string-from-alphabet-to-integer-mapping/description/ LeetCode - The World's Leading Online Programming Learning Platform 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 문자열을 다루는 문제였습니다. 📕 풀이방법 📔 입력 및 초기화 반환할 복호화된 문자열 decryptedString을 선언해줍니다. 📔 풀이과정 s의 원..
(C++) - LeetCode (easy) 1304. Find N Unique Integers Sum up to Zero https://leetcode.com/problems/find-n-unique-integers-sum-up-to-zero/ LeetCode - The World's Leading Online Programming Learning Platform 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 📕 풀이방법 📔 입력 및 초기화 정답 vector ans를 선언해줍니다. 📔 풀이과정 고유한 숫자에 부호만 나누어 ans에 분배해주면 됩니다. 짝수인 경우 부호만 다르게 고루 분배하면 되지만..
(C++) - LeetCode (easy) 1299. Replace Elements with Greatest Element on Right Side https://leetcode.com/problems/replace-elements-with-greatest-element-on-right-side/description/ LeetCode - The World's Leading Online Programming Learning Platform 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 priority_queue와 map을 이용해 해결한 문제였습니다. 📕 풀이방법 📔 입력 및 초기화 1. 정답 vector ans, 내림차순으로..