목록PS (883)
넘치게 채우기
https://leetcode.com/problems/count-sub-islands/description/?envType=daily-question&envId=2024-08-28leetcode - Count Sub Islands문제 유형 : bfs/dfs, 행렬문제 난이도 : Medium 문제You are given two m x n binary matrices grid1 and grid2 containing only 0's (representing water) and 1's (representing land). An island is a group of 1's connected 4-directionally (horizontal or vertical). Any cells outside of the gr..
https://leetcode.com/problems/path-with-maximum-probability/description/?envType=daily-question&envId=2024-08-27leetcode - Path with Maximum Probability문제 유형 : 최단거리, 다익스트라, bfs, 우선순위 큐, 그래프문제 난이도 : Medium 문제You are given an undirected weighted graph of n nodes (0-indexed), represented by an edge list where edges[i] = [a, b] is an undirected edge connecting the nodes a and b with a probability of..
https://leetcode.com/problems/n-ary-tree-postorder-traversal/description/?envType=daily-question&envId=2024-08-26leetcode - N-ary Tree Postorder Traversal문제 유형 : 트리, dfs, 재귀, 스택문제 난이도 : Easy 문제Given the root of an n-ary tree, return the postorder traversal of its nodes' values.Nary-Tree input serialization is represented in their level order traversal. Each group of children is separated by the ..
https://leetcode.com/problems/binary-tree-postorder-traversal/?envType=daily-question&envId=2024-08-25leetcode - Binary Tree Postorder Traversal문제 유형 : 트리, dfs, 이진트리문제 난이도 : Easy 문제Given the root of a binary tree, return the postorder traversal of its nodes' values. 이진트리의 루트가 주어진다, 노드의 값을 후위순회로 한 값을 반환하시오. 풀이후위순회의 순서는, 왼쪽 서브트리 -> 오른쪽 서브트리 -> 루트의 순서이다.이 순서대로 재귀호출 및 로직 처리를 해주면 된다. 코드C++/** * Defin..
https://leetcode.com/problems/find-the-closest-palindrome/description/?envType=daily-question&envId=2024-08-24leetcode - Find the Closest Palindrome문제 유형 : 팰린드롬, 회문, 문자열 처리문제 난이도 : Hard 문제Given a string n representing an integer, return the closest integer (not including itself), which is a palindrome. If there is a tie, return the smaller one.The closest is defined as the absolute difference mi..
https://leetcode.com/problems/fraction-addition-and-subtraction/description/?envType=daily-question&envId=2024-08-23leetcode - Fraction Addition and Subtraction문제 유형 : 문자열 처리, 수학, 정수론문제 난이도 : Medium 문제Given a string expression representing an expression of fraction addition and subtraction, return the calculation result in string format irreducible fraction. If your final result is an integer, c..
https://leetcode.com/problems/number-complement/description/?envType=daily-question&envId=2024-08-22leetcode - Number Complement문제 유형 : 수학, 비트마스킹문제 난이도 : Easy 문제The complement of an integer is the integer you get when you flip all the 0's to 1's and all the 1's to 0's in its binary representation.For example, The integer 5 is "101" in binary and its complement is "010" which is the integer 2.Giv..

https://leetcode.com/problems/strange-printer/description/?envType=daily-question&envId=2024-08-21leetcode - Strange Printer문제 유형 : 문자열 처리, 재귀, 다이나믹 프로그래밍, 투 포인터문제 난이도 : Hard 문제There is a strange printer with the following two special properties:The printer can only print a sequence of the same character each time.At each turn, the printer can print new characters starting from and ending at any..
https://leetcode.com/problems/stone-game-ii/description/?envType=daily-question&envId=2024-08-20leetcode - Stone Game II문제 유형 : 다이나믹 프로그래밍, 부분합문제 난이도 : Medium 문제Alice and Bob continue their games with piles of stones. There are a number of piles arranged in a row, and each pile has a positive integer number of stones piles[i]. The objective of the game is to end with the most stones.Alice and ..
https://leetcode.com/problems/2-keys-keyboard/solutions/?envType=daily-question&envId=2024-08-19leetcode - 2 Keys Keyboard문제 유형 : 다이나믹 프로그래밍, 재귀, 수학문제 난이도 : Medium 문제There is only one character 'A' on the screen of a notepad. You can perform one of two operations on this notepad for each step:Copy All: You can copy all the characters present on the screen (a partial copy is not allowed).Paste: Y..