1043. Partition Array for Maximum Sum
Given an integer array arr, partition the array into (contiguous) subarrays of length at most k. After partitioning, each subarray has their values changed to become the maximum value of that subarray.
Return the largest sum of the given array after partitioning. Test cases are generated so that the answer fits in a 32-bit integer.
1505. Minimum Possible Integer After at Most K Adjacent Swaps On Digits
You are given a string num representing the digits of a very large integer and an integer k. You are allowed to swap any two adjacent digits of the integer at most k times.
Return the minimum integer you can obtain also as a string.
A program was supposed to print an array of integers. The program forgot to print whitespaces and the array is printed as a string of digits s and all we know is that all integers in the array were in the range [1, k] and there are no leading zeros in the array.
Given the string s and the integer k, return the number of the possible arrays that can be printed as s using the mentioned program. Since the answer may be very large, return it modulo 109 + 7.
1329. Sort the Matrix Diagonally
A matrix diagonal is a diagonal line of cells starting from some cell in either the topmost row or leftmost column and going in the bottom-right direction until reaching the matrix’s end. For example, the matrix diagonal starting from mat[2][0], where mat is a 6 x 3 matrix, includes cells mat[2][0], mat[3][1], and mat[4][2].
Given an m x n matrix mat of integers, sort each matrix diagonal in ascending order and return the resulting matrix.
1106. Parsing A Boolean Expression
Return the result of evaluating a given boolean expression, represented as a string.
An expression can either be:
- “t”, evaluating to True;
- “f”, evaluating to False;
- “!(expr)”, evaluating to the logical NOT of the inner expression expr;
- “&(expr1,expr2,…)”, evaluating to the logical AND of 2 or more inner expressions expr1, expr2, …;
- “|(expr1,expr2,…)”, evaluating to the logical OR of 2 or more inner expressions expr1, expr2, …