All Posts

Leetcode 1749: Maximum Absolute Sum of Any Subarray

Given an array of integers nums, your task is to find the maximum absolute sum of any subarray. The absolute sum of a subarray is the absolute value of the sum of its elements.

Leetcode 1752: Check if Array Is Sorted and Rotated

You are given an array nums. The array is originally sorted in non-decreasing order and then rotated some number of positions (including zero). Your task is to determine if the array could have been rotated from a sorted array. Return true if the array can be rotated to become sorted, and false otherwise.

Leetcode 1760: Minimum Limit of Balls in a Bag

You are given an array nums where each element represents the number of balls in a bag. You can perform up to maxOperations operations, where each operation consists of splitting one bag of balls into two smaller bags. Each new bag must contain a positive number of balls. The goal is to minimize the maximum number of balls in any bag after performing the operations.

Leetcode 1764: Form Array by Concatenating Subarrays of Another Array

Given an array of subarrays groups and a single array nums, your task is to determine whether it is possible to extract each subarray from groups as a contiguous segment from nums. The subarrays must appear in the same order as in groups, and they should be disjoint, meaning no element from nums can belong to more than one subarray. Return true if this is possible, and false otherwise.

Leetcode 1765: Map of Highest Peak

Given a 2D grid where each cell is either water (1) or land (0), assign heights to the land cells such that the height difference between adjacent cells is at most 1. The goal is to maximize the height values of land cells while ensuring the height of water cells is 0. Return the grid with assigned heights.

Leetcode 1769: Minimum Number of Operations to Move All Balls to Each Box

You are given a binary string boxes of length n, where each character represents whether a box is empty (‘0’) or contains a ball (‘1’). Your task is to calculate, for each box, the minimum number of operations required to move all the balls to that particular box. An operation involves moving a ball from one box to an adjacent box.