Given an integer n, return the largest number less than or equal to n with digits in monotone increasing order, meaning each digit is less than or equal to the next one.
You are standing at position 0 on an infinite number line. There is a destination at position target. You can make some number of moves where, on the i-th move, you take exactly i steps either left or right. The goal is to determine the minimum number of moves required to reach the target.
Given two integers left and right, return the count of numbers in the inclusive range [left, right] having a prime number of set bits in their binary representation. The number of set bits in a number is the count of 1’s when the number is represented in binary. A prime number is a number greater than 1 that is divisible only by 1 and itself.
You are given an integer array nums of length n, which is a permutation of all integers in the range [0, n - 1]. A global inversion is a pair of indices (i, j) such that 0 <= i < j < n and nums[i] > nums[j]. A local inversion is a pair where 0 <= i < n - 1 and nums[i] > nums[i + 1]. Return true if the number of global inversions is equal to the number of local inversions.
We build a sequence of rows starting with the string ‘0’ in the first row. For each subsequent row, every occurrence of ‘0’ from the previous row is replaced with ‘01’, and every occurrence of ‘1’ is replaced with ‘10’. Given two integers n and k, return the k-th (1-indexed) symbol in the n-th row.
In a forest, there are an unknown number of rabbits. We ask n rabbits, ‘How many rabbits of the same color as you are there?’ and collect their answers in an integer array answers, where answers[i] is the answer of the i-th rabbit. The task is to determine the minimum number of rabbits that could be in the forest.