# LeetCode Solutions and Explanations

Here is a list of LeetCode problems solved by Goodtecher. Goodtecher will keep updating solutions and explains to LeetCode problems.…

# LeetCode 1293. Shortest Path in a Grid with Obstacles Elimination

Description https://leetcode.com/problems/shortest-path-in-a-grid-with-obstacles-elimination/ You are given an m x n integer matrix grid where each cell is either 0 (empty) or 1 (obstacle). You can move up, down, left,…

# LeetCode 1110. Delete Nodes And Return Forest

Description https://leetcode.com/problems/delete-nodes-and-return-forest/ Given the root of a binary tree, each node in the tree has a distinct value. After deleting all nodes…

# LeetCode 1057. Campus Bikes

Description https://leetcode.com/problems/campus-bikes/ On a campus represented on the X-Y plane, there are n workers and m bikes, with n <= m. You are given an…

# LeetCode 1059. All Paths from Source Lead to Destination

Description https://leetcode.com/problems/all-paths-from-source-lead-to-destination/ Given the edges of a directed graph where edges[i] = [ai, bi] indicates there is an edge between nodes ai and bi, and two nodes source and destination of…

# LeetCode 475. Heaters

Description https://leetcode.com/problems/heaters/ Winter is coming! During the contest, your first job is to design a standard heater with a fixed…

# LeetCode 216. Combination Sum III

Description https://leetcode.com/problems/combination-sum-iii/ Find all valid combinations of k numbers that sum up to n such that the following conditions are true: Only numbers 1 through 9 are used.…

# LeetCode 264. Ugly Number II

Description https://leetcode.com/problems/ugly-number-ii/ An ugly number is a positive integer whose prime factors are limited to 2, 3, and 5. Given an integer n, return the nth ugly number. Example…

# LeetCode 1631. Path With Minimum Effort

Description https://leetcode.com/problems/path-with-minimum-effort/ You are a hiker preparing for an upcoming hike. You are given heights, a 2D array of size rows x…

# LeetCode 272. Closest Binary Search Tree Value II

Description https://leetcode.com/problems/closest-binary-search-tree-value-ii/ Given the root of a binary search tree, a target value, and an integer k, return the k values in the BST that are closest to…

# LeetCode 1197. Minimum Knight Moves

Description https://leetcode.com/problems/minimum-knight-moves/ In an infinite chess board with coordinates from -infinity to +infinity, you have a knight at square [0, 0]. A knight has 8 possible moves it…