You are given a string s and a robot that starts with an empty string t. The robot can perform two operations: one, it can remove the first character of string s and append it to t, and two, it can remove the last character of string t and write it down. The goal is to return the lexicographically smallest string that can be written on paper using these operations.
Given a positive integer n, you need to construct an array called powers that contains the minimum number of powers of 2 that sum up to n. The array powers should be sorted in non-decreasing order. You are also given a set of queries where each query asks for the product of the powers in the powers array between indices left and right (both inclusive). For each query, return the product modulo 10^9 + 7.
You are given a 0-indexed array nums of length n, where each element represents the number of items in a container. In one operation, you can pick an index i such that 1 <= i < n and nums[i] > 0, and move one item from nums[i] to nums[i-1]. Your goal is to minimize the maximum value in the array nums after performing any number of operations.
You are given an array nums consisting of positive integers. For each number in the array, you need to reverse its digits and append the reversed number to the end of the array. After performing this operation for all numbers, return the number of distinct integers in the resulting array.
Given a non-negative integer num, determine if num can be expressed as the sum of a non-negative integer and its reverse. If so, return true, otherwise return false.
Given an integer array nums and an integer k, return the number of subarrays in which the greatest common divisor (GCD) of all the elements is exactly k. A subarray is a contiguous non-empty sequence of elements within the array.