Category: c / c++
Given a matrix with dimension NxN, rotate the matrix in place the 90 degrees clockwise and anti-clockwise. For example, original Matrix 3×3: vector<vector<int>> matrix({ {1, 2, 3}, {4, 5, …
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 …