[AtCoder] C - ThREERead more
[AtCoder] E - Three SubstringsRead more
[AtCoder] F - Distributing IntegersRead more
[Codeforces] Round 271 (Div. 2) D. FlowersRead more
[Codeforces] Round 274 (Div. 2) D. Long JumpsRead more
[Codeforces] Round 276 (Div. 1) A. BitsRead more
[Codeforces] Round 277 (Div. 2) C. Palindrome TransformationRead more
[Codeforces] Round 277.5 (Div. 2) D. Unbearable Controversy of BeingRead more
[LeetCode] Minimum Time to Complete All Tasks

2589. Minimum Time to Complete All Tasks

There is a computer that can run an unlimited number of tasks at the same time. You are given a 2D integer array tasks where tasks[i] = [starti, endi, durationi] indicates that the ith task should run for a total of durationi seconds (not necessarily continuous) within the inclusive time range [starti, endi].

You may turn on the computer only when it needs to run a task. You can also turn it off if it is idle.

Return the minimum time during which the computer should be turned on to complete all tasks.

Read more
[LeetCode] Count the Number of Beautiful Subarrays

2588. Count the Number of Beautiful Subarrays

You are given a 0-indexed integer array nums. In one operation, you can:

  • Choose two different indices i and j such that 0 <= i, j < nums.length.
  • Choose a non-negative integer k such that the kth bit (0-indexed) in the binary representation of nums[i] and nums[j] is 1.
  • Subtract 2k from nums[i] and nums[j].

A subarray is beautiful if it is possible to make all of its elements equal to 0 after applying the above operation any number of times.

Return the number of beautiful subarrays in the array nums.

A subarray is a contiguous non-empty sequence of elements within an array.

Read more