Twitter | Phone Screen | Number of continuous increasing count in array
Anonymous User
2466

Input: array of int
output: array of int which is a number of continuous increasing count

For example
input: [100, 10, 50, 60, 20, 90, 110]
output: [1, 1, 2, 3, 1, 5, 7]

The brute force solution is having two loops. The outer loop is iterating the input from the beginning to the end. The inner loop is to iterate from i back to the beginning and count the number of a element which is less than nums[i].

But is there moere optimized solution?

Comments (8)