[LeetCode] Maximize Score of Numbers in Ranges

3281. Maximize Score of Numbers in Ranges

You are given an array of integers start and an integer d, representing n intervals [start[i], start[i] + d].

You are asked to choose n integers where the ith integer must belong to the ith interval. The score of the chosen integers is defined as the minimum absolute difference between any two integers that have been chosen.

Return the maximum possible score of the chosen integers.

Read more
[LeetCode] Convert Date to Binary

3280. Convert Date to Binary

You are given a string date representing a Gregorian calendar date in the yyyy-mm-dd format.

date can be written in its binary representation obtained by converting year, month, and day to their binary representations without any leading zeroes and writing them down in year-month-day format.

Return the binary representation of date.

Read more
[Codeforces] Round 947 (Div. 1 + Div. 2) D. Paint the TreeRead more
[Codeforces] Round 946 (Div. 3) F. Cutting GameRead more
[LeetCode] Maximum Total Area Occupied by Pistons

3279. Maximum Total Area Occupied by Pistons

There are several pistons in an old car engine, and we want to calculate the maximum possible area under the pistons.

You are given:

  • An integer height
  • An integer array positions, where positions[i] is the current position of piston i
  • A string directions, where directions[i] is the current moving direction of piston i, 'U' for up, and 'D' for down.

Each second:

  • Every piston moves in its current direction 1 unit. e.g., if the direction is up, positions[i] is incremented by 1.
  • If a piston has reached one of the ends, i.e., positions[i] == 0 or positions[i] == height, its direction will change.

Return the maximum possible area under all the pistons.

Read more
[Codeforces] Round 946 (Div. 3) E. Money Buys HappinessRead more
[Codeforces] Round 945 (Div. 2) C. Cat, Fox and Double MaximumRead more
[Codeforces] Round 944 (Div. 4) G. XOURRead more
[Codeforces] Round 944 (Div. 4) F. Circle PerimeterRead more
[Codeforces] Helvetic Coding Contest 2024 online mirror (teams allowed, unrated) G1. Min-Fund Prison (Easy)Read more