10038. Maximize the Number of Partitions After Operations
You are given a 0-indexed string
sand an integerk.You are to perform the following partitioning operations until
sis empty:
- Choose the longest prefix of
scontaining at mostkdistinct characters.- Delete the prefix from
sand increase the number of partitions by one. The remaining characters (if any) insmaintain their initial order.Before the operations, you are allowed to change at most one index in
sto another lowercase English letter.Return an integer denoting the maximum number of resulting partitions after the operations by optimally choosing at most one index to change.
10037. Maximum Size of a Set After Removals
You are given two 0-indexed integer arrays
nums1andnums2of even lengthn.You must remove
n / 2elements fromnums1andn / 2elements fromnums2. After the removals, you insert the remaining elements ofnums1andnums2into a sets.Return the maximum possible size of the set
s.
10036. Minimum Moves to Capture The Queen
There is a 1-indexed
8 x 8chessboard containing3pieces.You are given
6integersa,b,c,d,e, andfwhere:
(a, b)denotes the position of the white rook.(c, d)denotes the position of the white bishop.(e, f)denotes the position of the black queen.Given that you can only move the white pieces, return the minimum number of moves required to capture the black queen.
Note that:
- Rooks can move any number of squares either vertically or horizontally, but cannot jump over other pieces.
- Bishops can move any number of squares diagonally, but cannot jump over other pieces.
- A rook or a bishop can capture the queen if it is located in a square that they can move to.
- The queen does not move.
10035. Maximum Area of Longest Diagonal Rectangle
You are given a 2D 0-indexed integer array
dimensions.For all indices
i,0 <= i < dimensions.length,dimensions[i][0]represents the length anddimensions[i][1]represents the width of the rectanglei.Return the area of the rectangle having the longest diagonal. If there are multiple rectangles with the longest diagonal, return the area of the rectangle having the maximum area.