본문 바로가기

Algorithm/Implementation

(512)
(C++) - LeetCode (easy) 1356. Sort Integers by The Number of 1 Bits https://leetcode.com/problems/sort-integers-by-the-number-of-1-bits/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 bitmasking을 이용한 문제였습니다. 📕 풀이방법 📔 풀이과정 1. arr을 정렬할 때 기준을 정해 sort해줍니다. 정렬 기준은 다음과 같습니다. 1 bit 개수..
(C++) - LeetCode (easy) 1351. Count Negative Numbers in a Sorted Matrix https://leetcode.com/problems/count-negative-numbers-in-a-sorted-matrix/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. grid의 행 r, 열 c를 선언 후 값을 저장합니다.2. 정답변수 negatives를 선언 후 0..
(C++) - LeetCode (easy) 1346. Check If N and Its Double Exist https://leetcode.com/problems/check-if-n-and-its-double-exist/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 간단 구현문제였습니다. 📕 풀이방법 📔 풀이과정 조건대로 arr에 대해 2차원 for loop를 수행하면서 i!=j면서 arr[i] == 2 * arr[j]인 경우를 찾습니다. 📔..
(C++) - LeetCode (easy) 1342. Number of Steps to Reduce a Number to Zero https://leetcode.com/problems/number-of-steps-to-reduce-a-number-to-zero/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 간단 구현 문제였습니다. 📕 풀이방법 📔 입력 및 초기화 정답 변수 cnt를 선언 후 0으로 초기화해줍니다. 📔 풀이과정 num이 0이 아닌 동안 while l..
(C++) - LeetCode (easy) 1332. Remove Palindromic Subsequences https://leetcode.com/problems/remove-palindromic-subsequences/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 간단 구현문제였습니다. 📕 풀이방법 📔 풀이과정 모든 문자열은 a또는 b로만 이루어져 있고 부분 문자열은 순서 상관 없이 고를 수 있으므로 최악의 횟수는 a, b각각 모아 지우는 ..
(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이 포함되어있는지 확인해 정..