In a bowling game, two players take turns to hit pins. Each player hits a certain number of pins per turn, and the total score is calculated based on how many pins they hit and whether they hit 10 pins in previous turns. If a player hits 10 pins in one of the previous two turns, their score for the current turn is doubled. The objective is to determine which player has the higher score after all turns have been played.
You are given a 0-indexed integer array nums of length n. Your task is to compute the ‘distinct difference array’ of nums. The distinct difference array, diff, is defined such that diff[i] equals the difference between the number of distinct elements in the prefix nums[0,...,i] and the number of distinct elements in the suffix nums[i+1,...,n-1]. Specifically, for each index i, compute diff[i] = distinct elements in the prefix - distinct elements in the suffix.
You are given a perfect binary tree with n nodes, where each node has a cost associated with it. The tree is numbered from 1 to n, with node 1 as the root. For each node i, its left child is 2*i and its right child is 2*i + 1. You are allowed to increment the cost of any node by 1 any number of times. Your task is to return the minimum number of increments required to make the total cost of the path from the root to each leaf node equal.
In this game, there are n friends sitting in a circle, numbered from 1 to n. The game starts with the 1st friend receiving a ball. The ball is passed to a friend k steps away in a clockwise direction, and then on each subsequent turn, the ball is passed to the friend i * k steps away, where i is the turn number (starting from 1). The game ends when any friend receives the ball for the second time. The friends who never receive the ball are considered the losers. The task is to return the list of losers in ascending order.
You are given a string s consisting of only uppercase English letters. You can repeatedly remove any occurrence of the substrings ‘AB’ or ‘CD’ from s. Each operation removes one of these substrings and shortens the string. After performing the operations, return the minimum possible length of the resulting string. Note that removing substrings can create new occurrences of ‘AB’ or ‘CD’, which can be removed in further operations.
You are given a string s consisting of lowercase English letters. You can perform operations on this string where in each operation, you replace a character in s with another lowercase English letter. The goal is to make s a palindrome using the minimum number of operations possible. If there are multiple ways to achieve the same minimum number of operations, return the lexicographically smallest palindrome string.