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.
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.
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.
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.
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.
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.