[LeetCode] Pour Water Between Buckets to Make Water Levels Equal

2137. Pour Water Between Buckets to Make Water Levels Equal

You have n buckets each containing some gallons of water in it, represented by a 0-indexed integer array buckets, where the ith bucket contains buckets[i] gallons of water. You are also given an integer loss.

You want to make the amount of water in each bucket equal. You can pour any amount of water from one bucket to another bucket (not necessarily an integer). However, every time you pour k gallons of water, you spill loss percent of k.

Return the maximum amount of water in each bucket after making the amount of water equal. Answers within 10-5 of the actual answer will be accepted.

Read more
[LeetCode] Minimum Moves to Reach Target Score

2139. Minimum Moves to Reach Target Score

You are playing a game with integers. You start with the integer 1 and you want to reach the integer target.

In one move, you can either:

  • Increment the current integer by one (i.e., x = x + 1).
  • Double the current integer (i.e., x = 2 * x).

You can use the increment operation any number of times, however, you can only use the double operation at most maxDoubles times.

Given the two integers target and maxDoubles, return the minimum number of moves needed to reach target starting with 1.

Read more
[LeetCode] Minimum Number of Lines to Cover Points

2152. Minimum Number of Lines to Cover Points

You are given an array points where points[i] = [xi, yi] represents a point on an X-Y plane.

Straight lines are going to be added to the X-Y plane, such that every point is covered by at least one line.

Return the minimum number of straight lines needed to cover all the points.

Read more
[LeetCode] Number of Single Divisor Triplets

2198. Number of Single Divisor Triplets

You are given a 0-indexed array of positive integers nums. A triplet of three distinct indices (i, j, k) is called a single divisor triplet of nums if nums[i] + nums[j] + nums[k] is divisible by exactly one of nums[i], nums[j], or nums[k].

Return the number of single divisor triplets of nums.

Read more
[LeetCode] Minimum Costs Using the Train Line

2361. Minimum Costs Using the Train Line

A train line going through a city has two routes, the regular route and the express route. Both routes go through the same n + 1 stops labeled from 0 to n. Initially, you start on the regular route at stop 0.

You are given two 1-indexed integer arrays regular and express, both of length n. regular[i] describes the cost it takes to go from stop i - 1 to stop i using the regular route, and express[i] describes the cost it takes to go from stop i - 1 to stop i using the express route.

You are also given an integer expressCost which represents the cost to transfer from the regular route to the express route.

Note that:

  • There is no cost to transfer from the express route back to the regular route.
  • You pay expressCost every time you transfer from the regular route to the express route.
  • There is no extra cost to stay on the express route.

Return a 1-indexed array costs of length n, where costs[i] is the minimum cost to reach stop i from stop 0.

Note that a stop can be counted as reached from either route.

Read more
[AtCoder] C - CandlesRead more
[AtCoder] B - Grid CompressionRead more
[AtCoder] D - Make Them EvenRead more
[AtCoder] C - SkipRead more
[AtCoder] A - Two AbbreviationsRead more