Solved! Leetcode 863. All Nodes Distance K in Binary Tree

Solved! Leetcode 863. All Nodes Distance K in Binary Tree
source: https://leetcode.com/problems/all-nodes-distance-k-in-binary-tree/description/ Table of ContentsAll Nodes Distance K in Binary TreeExample 1:Example 2:Constraints:Solution All Nodes Distance K in Binary Tree Description Given the root of a binary tree, the value of a target node target, and an integer k, return an array of the values of all nodes that have a distance k from the ...

Solved! Leetcode 1514. Path with Maximum Probability

Solved! Leetcode 1514. Path with Maximum Probability
source: https://leetcode.com/problems/path-with-maximum-probability/description/ Table of ContentsPath with Maximum ProbabilityDescriptionExample 1:Example 2:Example 3:Constraints:Solution Path with Maximum Probability Description 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 success of traversing that ...

Solved! Leetcode 2024. Maximize the Confusion of an Exam

source: https://leetcode.com/problems/maximize-the-confusion-of-an-exam/description/ Table of ContentsMaximize the Confusion of an ExamDescriptionExample 1:Example 2:Example 3:Constraints:Solution Maximize the Confusion of an Exam Description A teacher is writing a test with n true/false questions, with ‘T’ denoting true and ‘F’ denoting false. He wants to confuse the students by maximizing the number of consecutive questions with the same answer ...

Solved! Leetcode 1230. Toss Strange Coins

source: https://leetcode.com/problems/toss-strange-coins/description/ Toss Strange Coins Table of ContentsToss Strange CoinsDescriptionExample 1:Example 2:Constraints:Solution Description You have some coins. The i-th coin has a probability prob[i] of facing heads when tossed. Return the probability that the number of coins facing heads equals target if you toss every coin exactly once. Example 1: Input: prob = [0.4], target ...

Solved! Leetcode 1376. Time Needed to Inform All Employees

Solved! Leetcode 1376. Time Needed to Inform All Employees
source: https://leetcode.com/problems/time-needed-to-inform-all-employees/description/ Time Needed to Inform All Employees Table of ContentsTime Needed to Inform All EmployeesDescriptionExample 1:Example 2:Constraints:Solution Description A company has n employees with a unique ID for each employee from 0 to n – 1. The head of the company is the one with headID. Each employee has one direct manager given in ...

Solved! Leetcode 1214. Two Sum BSTs

Solved! Leetcode 1214. Two Sum BSTs
source: https://leetcode.com/problems/two-sum-bsts/ Two Sum BSTs Description Given the roots of two binary search trees, root1 and root2, return true if and only if there is a node in the first tree and a node in the second tree whose values sum up to a given integer target. Example 1: Input: root1 = [2,1,4], root2 = ...

Solved! Leetcode 2462. Total Cost to Hire K Workers 1

source: https://leetcode.com/problems/total-cost-to-hire-k-workers/description/ Total Cost to Hire K Workers Table of ContentsTotal Cost to Hire K WorkersDescriptionExample 1:Example 2:Constraints:Solution Description You are given a 0-indexed integer array costs where costs[i] is the cost of hiring the ith worker. You are also given two integers k and candidates. We want to hire exactly k workers according to ...

Solved! Leetcode 1575. Count All Possible Routes

source: https://leetcode.com/problems/count-all-possible-routes/ Count All Possible Routes Description You are given an array of distinct positive integers locations where locations[i] represents the position of city i. You are also given integers start, finish and fuel representing the starting city, ending city, and the initial amount of fuel you have, respectively. At each step, if you are ...

Solved! Leetcode 2090. K Radius Subarray Averages

Solved! Leetcode 2090. K Radius Subarray Averages
source: https://leetcode.com/problems/k-radius-subarray-averages/description/ Table of ContentsK Radius Subarray AveragesDescriptionExample 1:Example 2:Example 3:Constraints:Solution K Radius Subarray Averages Description You are given a 0-indexed array nums of n integers and an integer k. The k-radius average for a subarray of nums centered at some index i with the radius k is the average of all elements in nums between ...

Solved! Leetcode 1732. Find the Highest Altitude

source: https://leetcode.com/problems/find-the-highest-altitude/description/ Find the Highest Altitude Table of ContentsFind the Highest AltitudeDescriptionExample 1:Example 2:Constraints:Solution Description There is a biker going on a road trip. The road trip consists of n + 1 points at different altitudes. The biker starts his trip on point 0 with altitude equal 0. You are given an integer array gain ...