You are given an integer array nums of length n and an integer array queries of length m. For each query, return the maximum size of a subsequence that can be selected from nums such that the sum of its elements is less than or equal to the query value. A subsequence is derived by deleting some or no elements from the array while keeping the relative order intact.
Given a 0-indexed array of non-negative integers, ’nums’, you need to find the length of the smallest subarray starting at each index that has the maximum possible bitwise OR. For each index ‘i’, find the minimum length subarray nums[i…j] such that the bitwise OR of this subarray equals the maximum OR value possible starting from index ‘i’.
You are given a stream of n distinct videos, each represented by a unique number from 1 to n. You need to design a data structure that tracks the longest prefix of uploaded videos at any point in time. A prefix is considered uploaded if all videos from 1 to i (inclusive) have been uploaded to the server.
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 the root of a binary search tree (BST) and an array of queries. For each query, find the largest value smaller than or equal to the query value and the smallest value greater than or equal to the query value in the tree.
A frog starts on the first stone in a river and wants to jump to the last stone and then return to the first stone. The frog can jump to any stone at most once. The cost of a jump is defined as the absolute difference between the positions of two stones. The frog must choose a path that minimizes the maximum jump length during the entire journey. Return the minimum cost of the path where the cost is defined as the maximum length of any jump.