[Codeforces] Round 951 (Div. 2) D. Fixing a Binary StringRead more
[Codeforces] Round 953 (Div. 2) D. ElectionsRead more
[Codeforces] Round 948 (Div. 2) C. Nikita and LCMRead more
[Codeforces] Educational Round 166 (Rated for Div. 2) C. Job InterviewRead more
[LeetCode] Maximum Number of Moves to Kill All Pawns

3283. Maximum Number of Moves to Kill All Pawns

There is a 50 x 50 chessboard with one knight and some pawns on it. You are given two integers kx and ky where (kx, ky) denotes the position of the knight, and a 2D array positions where positions[i] = [xi, yi] denotes the position of the pawns on the chessboard.

Alice and Bob play a turn-based game, where Alice goes first. In each player’s turn:

  • The player selects a pawn that still exists on the board and captures it with the knight in the fewest possible moves. Note that the player can select any pawn, it might not be one that can be captured in the least number of moves.
  • In the process of capturing the selected pawn, the knight may pass other pawns without capturing them. Only the selected pawn can be captured in this turn.

Alice is trying to maximize the sum of the number of moves made by both players until there are no more pawns on the board, whereas Bob tries to minimize them.

Return the maximum total number of moves made during the game that Alice can achieve, assuming both players play optimally.

Note that in one move, a chess knight has eight possible positions it can move to, as illustrated below. Each move is two cells in a cardinal direction, then one cell in an orthogonal direction.

Read more
[LeetCode] Reach End of Array With Max Score

3282. Reach End of Array With Max Score

You are given an integer array nums of length n.

Your goal is to start at index 0 and reach index n - 1. You can only jump to indices greater than your current index.

The score for a jump from index i to index j is calculated as (j - i) * nums[i].

Return the maximum possible total score by the time you reach the last index.

Read more
[LeetCode] Maximize Score of Numbers in Ranges

3281. Maximize Score of Numbers in Ranges

You are given an array of integers start and an integer d, representing n intervals [start[i], start[i] + d].

You are asked to choose n integers where the ith integer must belong to the ith interval. The score of the chosen integers is defined as the minimum absolute difference between any two integers that have been chosen.

Return the maximum possible score of the chosen integers.

Read more
[LeetCode] Convert Date to Binary

3280. Convert Date to Binary

You are given a string date representing a Gregorian calendar date in the yyyy-mm-dd format.

date can be written in its binary representation obtained by converting year, month, and day to their binary representations without any leading zeroes and writing them down in year-month-day format.

Return the binary representation of date.

Read more
[Codeforces] Round 947 (Div. 1 + Div. 2) D. Paint the TreeRead more
[Codeforces] Round 946 (Div. 3) F. Cutting GameRead more