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 2D array nums where each row represents a set of numbers. You perform operations on the matrix by removing the largest number from each row at each step. After removing the largest number from each row, you identify the highest number amongst all those removed and add it to your score. Repeat this until the matrix becomes empty and return the final score.
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 permutation of integers from 1 to n. A permutation is called semi-ordered if the first element equals 1 and the last element equals n. You can perform the operation of swapping two adjacent elements as many times as needed to make the permutation semi-ordered. Your task is to return the minimum number of swaps required.
A truck has two fuel tanks, one main tank and one additional tank. The truck’s mileage is 10 km per liter, and fuel from the additional tank can be injected into the main tank after every 5 liters of fuel consumed. Your task is to calculate the maximum distance the truck can travel, considering both the main tank and the additional tank.