All Posts

Leetcode 1673: Find the Most Competitive Subsequence

Given an integer array nums and a positive integer k, return the most competitive subsequence of nums of size k. A subsequence is more competitive than another if at the first position where they differ, the subsequence has a smaller number.

Leetcode 1674: Minimum Moves to Make Array Complementary

You are given an integer array nums of even length n and an integer limit. In one move, you can replace any element of nums with another integer between 1 and limit (inclusive). The array nums is complementary if for all indices i, nums[i] + nums[n - 1 - i] equals the same number. Return the minimum number of moves required to make nums complementary.

Leetcode 1680: Concatenation of Consecutive Binary Numbers

Given an integer n, form a binary string by concatenating the binary representations of all integers from 1 to n. Convert this concatenated binary string to its decimal equivalent and return the result modulo 10^9 + 7.

Leetcode 1685: Sum of Absolute Differences in a Sorted Array

You are given a sorted integer array nums. Build and return an integer array result such that for each index i, result[i] is equal to the summation of absolute differences between nums[i] and all other elements in the array.

Leetcode 1686: Stone Game VI

Alice and Bob take turns playing a game with a pile of n stones, each having a value assigned by both players. They play optimally and aim to maximize their total points by choosing stones with the highest value for each player.

Leetcode 1690: Stone Game VII

Alice and Bob are playing a game with a row of n stones. On each player’s turn, they can remove the leftmost or the rightmost stone, and their score is the sum of the remaining stones. Alice tries to maximize the score difference, while Bob aims to minimize it. Calculate the score difference between Alice and Bob when both play optimally.