prices = [1, 2, 3, 2, 3]
n = len(prices)
answer = [0] * n

for i in range(n):
    time = 0
    for j in range(i + 1, n):
        time += 1
        if prices[j] < prices[i]:
            break
    answer[i] = time

print(answer)

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: