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 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 1046. Last Stone Weight

source: https://leetcode.com/problems/last-stone-weight/description/ Last Stone Weight You are given an array of integers stones where stones[i] is the weight of the ith stone. We are playing a game with the stones. On each turn, we choose the heaviest two stones and smash them together. Suppose the heaviest two stones have weights x and y with x ...

Solved! Leetcode 23. Merge k Sorted Lists

Table of ContentsMerge k Sorted ListsJavaPythonTime ComplexitySpace Complexity source: https://leetcode.com/problems/merge-k-sorted-lists/ Merge k Sorted Lists You are given an array of k linked-lists lists, each linked-list is sorted in ascending order. Merge all the linked-lists into one sorted linked-list and return it. Example 1:Input: lists = [[1,4,5],[1,3,4],[2,6]]Output: [1,1,2,3,4,4,5,6]Explanation: The linked-lists are:[1->4->5,1->3->4,2->6]merging them into one sorted list:1->1->2->3->4->4->5->6 ...

Leetcode 1167: Minimum Cost to Connect Sticks

You have some number of sticks with positive integer lengths. These lengths are given as an array sticks, where sticks[i] is the length of the ith stick. You can connect any two sticks of lengths x and y into one stick by paying a cost of x + y. You must connect all the sticks until there is only one stick remaining. Return the minimum cost of connecting ...

Leetcode 1834: Single-Threaded CPU

You are given n​​​​​​ tasks labeled from 0 to n - 1 represented by a 2D integer array tasks, where tasks[i] = [enqueueTimei, processingTimei] means that the i​​​​​​th​​​​ task will be available to process at enqueueTimei and will take processingTimeito finish processing. You have a single-threaded CPU that can process at most one task at a time and will act in the following way: If the CPU is idle ...