목록PS/LeetCode (587)
넘치게 채우기
https://leetcode.com/problems/maximum-score-words-formed-by-letters/description/leetcode - Maximum Score Words Formed by Letters문제 유형 : 재귀, 백트래킹, dfs, 문자열 처리문제 난이도 : Hard 문제Given a list of words, list of single letters (might be repeating) and score of every character.Return the maximum score of any valid set of words formed by using the given letters (words[i] cannot be used two or more times)..
https://leetcode.com/problems/the-number-of-beautiful-subsets/description/leetcode - The Number of Beautiful Subsets문제 유형 : 백트래킹, dfs, 재귀문제 난이도 : Medium 문제You are given an array nums of positive integers and a positive integer k.A subset of nums is beautiful if it does not contain two integers with an absolute difference equal to k.Return the number of non-empty beautiful subsets of the array nu..
https://leetcode.com/problems/palindrome-partitioning/description/leetcode - Palindrome Partitioning문제 유형 : 문자열 처리, 재귀, dfs, 백트래킹문제 난이도 : Medium 문제Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. 문자열 s가 주어진다.모든 (s를 쪼갠 조각들이 팰린드롬 문자열)인 집합들을 반환하시오. ex-> "aab"는 ["a", "a", "b"]로 나누면 모두 팰린드롬인 문자열들로 나눈 것입니다. 풀이재귀..
https://leetcode.com/problems/subsets/description/leetcode - Subsets문제 유형 : dfs, 백트래킹, 재귀, 비트마스킹문제 난이도 : Medium 문제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. 중복이 없는 요소들의 정수 배열 nums가 주어진다. 모든 부분집합을 만드시오.중복된 부분집합을 허용하지 않습니다.순서는 상관 없습니다. 풀이백트래킹 풀이 - 빈 배열부터 시작해서 이번 인..
https://leetcode.com/problems/sum-of-all-subset-xor-totals/description/leetcode - Sum of All Subset XOR Totals문제 유형 : 비트마스킹문제 난이도 : Easy 문제The XOR total of an array is defined as the bitwise XOR of all its elements, or 0 if the array is empty.For example, the XOR total of the array [2,5,6] is 2 XOR 5 XOR 6 = 1.Given an array nums, return the sum of all XOR totals for every subset of nums. Note: ..
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/vNUVx/btsHu4eCScT/Sv6XwUDRYTgTcYThf9ttYK/img.png)
https://leetcode.com/problems/find-the-maximum-sum-of-node-values/description/leetcode - Find the Maximum Sum of Node Values문제 유형 : 수학, 비트마스킹, 트리문제 난이도 : Hard 문제There exists an undirected tree with n nodes numbered 0 to n - 1. You are given a 0-indexed 2D integer array edges of length n - 1, where edges[i] = [ui, vi] indicates that there is an edge between nodes ui and vi in the tree. You are al..
https://leetcode.com/problems/distribute-coins-in-binary-tree/description/leetcode - Distribute Coins in Binary Tree문제 유형 : 이진트리, dfs, 재귀, 부분합문제 난이도 : Medium 문제You are given the root of a binary tree with n nodes where each node in the tree has node.val coins. There are n coins in total throughout the whole tree.In one move, we may choose two adjacent nodes and move one coin from one node to an..
https://leetcode.com/problems/delete-leaves-with-a-given-value/description/leetcode - Delete Leaves With a Given Value문제 유형 : 이진트리, dfs, 재귀문제 난이도 : Medium 문제Given a binary tree root and an integer target, delete all the leaf nodes with value target.Note that once you delete a leaf node with value target, if its parent node becomes a leaf node and has the value target, it should also be deleted (..
https://leetcode.com/problems/evaluate-boolean-binary-tree/description/leetcode - Evaluate Boolean Binary Tree문제 유형 : 이진트리, dfs, 재귀문제 난이도 : Easy 문제You are given the root of a full binary tree with the following properties:Leaf nodes have either the value 0 or 1, where 0 represents False and 1 represents True.Non-leaf nodes have either the value 2 or 3, where 2 represents the boolean OR and 3 rep..
https://leetcode.com/problems/find-the-safest-path-in-a-grid/description/leetcode - Find the Safest Path in a Grid문제 유형 : bfs, 우선순위 큐, 다익스트라, 최단거리문제 난이도 : Medium 문제You are given a 0-indexed 2D matrix grid of size n x n, where (r, c) represents:A cell containing a thief if grid[r][c] = 1An empty cell if grid[r][c] = 0You are initially positioned at cell (0, 0). In one move, you can move to any ad..