Category: c / c++
Given an array of positive integers arr, calculate the sum of all possible odd-length subarrays. A subarray is a contiguous subsequence of the array. Return the sum of all …
You’re given a list of n integers arr. You must compute a list output such that, for each index i (between 0 and n-1, inclusive), output is equal to …
Balanced Split Given an array of integers (which may include repeated integers), determine if there’s a way to split the array into two subarrays A and B such that …
Revenue Milestones X keeps track of the revenue X makes every day, and X wants to know on what days X hits certain revenue milestones. Given an array of …
Given a sequence of n integers arr, determine the lexicographically smallest sequence which may be obtained from it after performing at most k element swaps, each involving a pair …