Category: math
You are given two arrays rowSum and colSum of non-negative integers where rowSum is the sum of the elements in the ith row and colSum is the sum of …
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, …
A Math Problem: Family’s Age This year, sum of the family ‘s age is 100. There are Dad, Mum, Brother, and Sister in the family. And we know: Brother …
Given a stream of integers and a window size, calculate the moving average of all integers in the sliding window. Example: MovingAverage m = new MovingAverage(3); m.next(1) = 1 …
Consider the following function to make changes to an array of numbers: func modify(arr, op, idx) { // add by 1 index idx if (op == 0) { arr …