전체 글 422

[Backtracking][Medium] 131. Palindrome Partitioning

https://leetcode.com/problems/palindrome-partitioning/description Palindrome Partitioning - LeetCode Can you solve this real interview question? Palindrome Partitioning - 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 Q. 주어진 문장 s 에 대해, 파티션으로 문자를 나눈다. 이때 이 나눠진 문자(sub string) 모두가 palindrome ..

[Backtracking][Medium] 79. Word Search

https://leetcode.com/problems/word-search/description Word Search - LeetCode Can you solve this real interview question? Word Search - Given an m x n grid of characters board and a string word, return true if word exists in the grid. The word can be constructed from letters of sequentially adjacent cells, where adjacent cells are h leetcode.com Q. 주어진 board와 word에서 해당 board 안에 word가 있는지 여부를 반환하라..

[Backtrack][Medium] 78. Subsets

https://leetcode.com/problems/subsets/description Subsets - LeetCode Can you solve this real interview question? Subsets - Given an integer array nums of unique elements, return all possible subsets (the power set). The solution set must not contain duplicate subsets. Return the solution in any order. Example 1: Input: n leetcode.com Q. nums 배열이 주어질때, blank를 포함한 해당 배열로 조합 가능한 모든 subset을 찾아라. Sol..

[Backtracking][Hard] 51. N-Queens

https://leetcode.com/problems/n-queens/description N-Queens - LeetCode Can you solve this real interview question? N-Queens - The n-queens puzzle is the problem of placing n queens on an n x n chessboard such that no two queens attack each other. Given an integer n, return all distinct solutions to the n-queens puzzle. You ma leetcode.com Q. n-queens 퍼즐에 맞게 Q 를 n x n 체스보드에 맞게 배치하여라. Solution. 역시..

[Backtracking][Medium] 46. Permutations

https://leetcode.com/problems/permutations/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 Q. 주어진 배열 값 nums 가 있을 때, 이 배열로 조합 가능한 모든 조합을 출력하라. Solution. 좋은 문제임과 동시에 실제 많이 접할 수 있는 문제. 모든 수 조합을 하나씩 넣어보고, 유일한 조합인지 확..

[Backtracking][Medium] 39. Combination Sum

https://leetcode.com/problems/combination-sum/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 Q. 정수 배열인 candidates 와 target 이 주어질 때, 그 합이 target이 되는 유일한 candidates 조합들을 모두 찾아라. Solution. Backtrack의 기본은 모든 원소를 순회..

[Backtracking][Medium] 22. Generate Parentheses

https://leetcode.com/problems/generate-parentheses/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 Q. n이 주어질때, n 쌍이 되도록 괄호를 open/close 규칙에 맞게 만들어라. Solution. 좋은 문제다. 풀이법을 반드시 숙지하면 좋다. 우선 한번의 문자를 추가할 시 두개의 옵션이 생긴..

[Heap/Priority Queue][Medium] 2462. Total Cost to Hire K Workers

https://leetcode.com/problems/total-cost-to-hire-k-workers/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 Q. k수의 worker를 고용한다고 할때, costs는 각 worker의 비용이다. 아래와 같은 규칙으로 worker를 고용한다고 할때, k회의 세션 이후 최종 고용비용을 반환하라. ..

Leetcode/LeetCode75 2024.02.18

[Trie][Medium] 1268. Search Suggestions System

https://leetcode.com/problems/search-suggestions-system/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 Q. searchWord를 입력함에 따라, products 중에서 이름이 겹치는 순서대로 제시어를 출력하라. 이때 제시어는 최대 3개가 되게 할 것이며, 각 제시어는 lexicorgraphic..

Leetcode/LeetCode75 2024.02.15

[Trie][Medium] 208. Implement Trie (Prefix Tree)

https://leetcode.com/problems/implement-trie-prefix-tree/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 Q. Trie class를 insert(), search(), startsWith()와 함께 구현하라. Solution. 우선 Trie 자료 구조에 대해서 좀 정리 해 보자. Trie는 문자..

Leetcode/LeetCode75 2024.02.14