All Posts

Leetcode 1684: Count the Number of Consistent Strings

You are given a string allowed consisting of distinct characters, and an array of strings words. A string is consistent if all characters in the string appear in the string allowed. Return the number of consistent strings in the array words.

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.

Leetcode 1695: Maximum Erasure Value

You are given an array of positive integers. Your task is to erase a subarray containing only unique elements and return the maximum sum of the subarray you can erase.

Leetcode 1696: Jump Game VI

You are given a 0-indexed integer array ’nums’ and an integer ‘k’. You start at index 0 and can jump up to ‘k’ steps forward at a time. Your task is to find the maximum sum of elements you can get by jumping to the last index, visiting subarrays of unique elements.