Solved! Leetcode 139. Word Break

source: https://leetcode.com/problems/word-break/ Table of ContentsWord BreakDescriptionExample 1:Example 2:Example 3:Constraints:Solution Word Break Description Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dictionary words. Note that the same word in the dictionary may be reused multiple times in the segmentation. ...

Solved! Leetcode 920. Number of Music Playlists

source: https://leetcode.com/problems/number-of-music-playlists/ Table of ContentsNumber of Music PlaylistsDescriptionExample 1:Example 2:Example 3:Constraints:Solution Number of Music Playlists Description Your music player contains n different songs. You want to listen to goal songs (not necessarily different) during your trip. To avoid boredom, you will create a playlist so that: Every song is played at least once. A song ...

Solved! Leetcode 137. Single Number II

source: https://leetcode.com/problems/single-number-ii/description/ Table of ContentsSingle Number IIDescriptionExample 1:Example 2:Constraints:Solution Single Number II Description Given an integer array nums where every element appears three times except for one, which appears exactly once. Find the single element and return it. You must implement a solution with a linear runtime complexity and use only constant extra space. Example ...

Solved! Leetcode 1161. Maximum Level Sum of a Binary Tree

Solved! Leetcode 1161. Maximum Level Sum of a Binary Tree
source: https://leetcode.com/problems/maximum-level-sum-of-a-binary-tree/description/ Table of ContentsMaximum Level Sum of a Binary TreeExample 1:Example 2:Constraints:Solution Maximum Level Sum of a Binary Tree Given the root of a binary tree, the level of its root is 1, the level of its children is 2, and so on. Return the smallest level x such that the sum of all ...

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 ...