본문 바로가기

👨‍💻 LeetCode15

[leetcode/JS] 40_Combination Sum II 풀이 🎲 문제 40. Combination Sum II Medium 후보 번호(candidates) 모음과 타겟 번호(target)가 주어지면 후보 번호 요소의 합계가 target인 모든 고유한 조합을 찾습니다. 후보자의 각 번호는 조합에서 한 번만 사용할 수 있습니다. 참고: 솔루션 세트는 중복 조합을 포함하지 않아야 합니다. 더보기 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 .. 2022. 12. 1.
[leetcode/JS] 326_Power of Three 풀이 🎲 문제 326. Power of Three Easy 정수 n이 주어지면 3의 거듭제곱이면 true를 반환한다. 그렇지 않으면 false를 반환한다. n == 3 x제곱인 정수 x가 존재할 경우, 정수 n은 3의 거듭제곱이다. 더보기 Given an integer n, return true if it is a power of three. Otherwise, return false. An integer n is a power of three, if there exists an integer x such that n == 3x. Example 1: Input: n = 27 Output: true Explanation: 27 = 33 Example 2: Input: n = 0 Output: false Expl.. 2022. 12. 1.
[leetcode/JS] 290_Word Pattern 풀이 🎲 문제 290. Word Pattern Easy 패턴과 문자열 s가 주어지면 s가 동일한 패턴을 따르는지 확인합니다. 여기서 follow는 패턴의 문자와 s의 비어 있지 않은 단어 사이에 이항이 있는 완전 일치를 의미합니다. ps. 주어진 패턴과 맞는지 확인 하는 문제 더보기 Given a pattern and a string s, find if s follows the same pattern. Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in s. Example 1: Input: pattern = "abba", s = "dog cat cat dog.. 2022. 12. 1.
[leetcode/JS] 292_Nim Game 풀이 🎲 문제 Nim Game - 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 292. Nim Game Easy 친구와 함께 다음 Nim 게임을 하고 있습니다. 처음에는 탁자 위에 돌무더기가 놓여 있습니다. 당신과 당신의 친구는 교대로 번갈아가며 당신이 먼저 갑니다. 매 차례마다 차례가 된 사람은 더미에서 1~3개의 돌을 제거합니다. 마지막 돌을 제거하는 사람이 승자입니다. n이 주어졌을 때, 당신과 당신의 친구가 최적으로 플레이한다고 가정하고 게임에서 이길 수 있.. 2022. 11. 28.
[leetcode/JS] 232_Implement Queue using Stacks 풀이 🎲 문제 Implement Queue using Stacks - 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 232. Implement Queue using Stacks Easy 두 개의 스택만 사용하여 선입선출(FIFO) 큐(Queue)를 구현합니다. 구현된 큐은 일반 큐의 모든 기능을 지원해야 합니다. (push, peek, pop, and empty) the MyQueue class 구현: void push(int x) 요소 x를 큐의 뒤쪽으로 푸시합니다.. 2022. 11. 20.
[leetcode/JS] 283_Move Zeroes 풀이 🎲 문제 Move Zeroes - 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 283. Move Zeroes Easy 정수 배열 nums가 주어지면 0이 아닌 요소의 상대적인 순서를 유지하면서 모든 0을 끝으로 이동합니다. 배열의 복사본을 만들지 않고 이 작업을 제자리에서 수행해야 합니다. 더보기 Given an integer array nums, move all 0's to the end of it while maintaining the relative or.. 2022. 11. 20.