Algorithm · Goldman Sachs · Easy
Implement countIncreasingSegments(transactionValues, k). You are given an integer array transactionValues of length n, where transactionValues[i] is the transaction amount at time i, and an integer k. Count the contiguous subarrays of transactionValues that have length exactly k and are strictly increasing from left to right. A length-k window starting at index i qualifies when $$\text{transactionValues}[i] < \text{transactionValues}[i+1] < \cdots <…
Checking your access…