[LeetCode] Matrix Similarity After Cyclic Shifts

2946. Matrix Similarity After Cyclic Shifts

You are given a 0-indexed m x n integer matrix mat and an integer k. You have to cyclically right shift odd indexed rows k times and cyclically left shift even indexed rows k times.

Return true if the initial and final matrix are exactly the same and false otherwise.

Read more
[Codeforces] Round 285 (Div. 2) D. Misha and Permutations SummationRead more
[Codeforces] Round 289 (Div. 2, ACM ICPC Rules) C. Sums of DigitsRead more
[Codeforces] Round 289 (Div. 2, ACM ICPC Rules) E. Pretty SongRead more
[Codeforces] Rockethon 2015 C. Second price auctionRead more
[Codeforces] Round 291 (Div. 2) C. Watto and MechanismRead more
[LeetCode] Find Maximum Non-decreasing Array Length

2945. Find Maximum Non-decreasing Array Length

You are given a 0-indexed integer array nums.

You can perform any number of operations, where each operation involves selecting a subarray of the array and replacing it with the sum of its elements. For example, if the given array is [1,3,5,6] and you select subarray [3,5] the array will convert to [1,8,6].

Return the maximum\ length of a non-decreasing\ array that can be made after applying operations.

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

Read more
[LeetCode] Minimum Number of Coins for Fruits

2944. Minimum Number of Coins for Fruits

You are at a fruit market with different types of exotic fruits on display.

You are given a 1-indexed array prices, where prices[i] denotes the number of coins needed to purchase the ith fruit.

The fruit market has the following offer:

  • If you purchase the ith fruit at prices[i] coins, you can get the next i fruits for free.

Note that even if you can take fruit j for free, you can still purchase it for prices[j] coins to receive a new offer.

Return the minimum number of coins needed to acquire all the fruits.

Read more
[LeetCode] Maximize Area of Square Hole in Grid

2943. Maximize Area of Square Hole in Grid

There is a grid with n + 2 horizontal bars and m + 2 vertical bars, and initially containing 1 x 1 unit cells.

The bars are 1-indexed.

You are given the two integers, n and m.

You are also given two integer arrays: hBars and vBars.

  • hBars contains distinct horizontal bars in the range [2, n + 1].
  • vBars contains distinct vertical bars in the range [2, m + 1].

You are allowed to remove bars that satisfy any of the following conditions:

  • If it is a horizontal bar, it must correspond to a value in hBars.
  • If it is a vertical bar, it must correspond to a value in vBars.

Return an integer denoting the maximum area of a square-shaped hole in the grid after removing some bars (possibly none).

Read more
[LeetCode] Find Words Containing Character

2942. Find Words Containing Character

You are given a 0-indexed array of strings words and a character x.

Return an array of indices representing the words that contain the character x.

Note that the returned array may be in any order.

Read more