[AtCoder] D - Lazy FaithRead more
[AtCoder] D - Restore the TreeRead more
[Codeforces] Round #167 (Div. 2) C. Dima and StaircaseRead more
[Codeforces] Round #168 (Div. 1) A. k-Multiple Free SetRead more
[Codeforces] Round #170 (Div. 2) B. New ProblemRead more
[Codeforces] Dytechlab Cup 2022 C. Ela and CricketsRead more
[Codeforces] Educational Round 136 (Rated for Div. 2) C. Card GameRead more
[LeetCode] Longest Subarray With Maximum Bitwise AND

2419. Longest Subarray With Maximum Bitwise AND

You are given an integer array nums of size n.

Consider a non-empty subarray from nums that has the maximum possible bitwise AND.

  • In other words, let k be the maximum value of the bitwise AND of any subarray of nums. Then, only subarrays with a bitwise AND equal to k should be considered.

Return the length of the longest such subarray.

The bitwise AND of an array is the bitwise AND of all the numbers in it.

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

Read more
[LeetCode] Find All Good Indices

2420. Find All Good Indices

You are given a 0-indexed integer array nums of size n and a positive integer k.

We call an index i in the range k <= i < n - k good if the following conditions are satisfied:

  • The k elements that are just before the index i are in non-increasing order.
  • The k elements that are just after the index i are in non-decreasing order.

Return an array of all good indices sorted in increasing order.

Read more
[LeetCode] Merge Operations to Turn Array Into a Palindrome

2422. Merge Operations to Turn Array Into a Palindrome

You are given an array nums consisting of positive integers.

You can perform the following operation on the array any number of times:

  • Choose any two adjacent elements and replace them with their sum.
  • For example, if nums = [1,2,3,1], you can apply one operation to make it [1,5,1].

Return the minimum number of operations needed to turn the array into a palindrome.

Read more