TORONTO KIDS COMPUTER CLUB | Monday 20:00 Python Practice 21.04.12.
19296
post-template-default,single,single-post,postid-19296,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.8.0,vc_responsive

Monday 20:00 Python Practice 21.04.12.

18 Apr Monday 20:00 Python Practice 21.04.12.

Question:
During this COVID19 outbreak, the gold price are very much unstable. Jack is very much tensed. He has asked Ken to analyze the gold price rate. Now Ken is given a report of N consecutive days containing gold price of those N consecutive days. Ken has to check for how many days (including the ith day) the ith price was greater than or equal to its previous consecutive days. He will report the final result for each given N days.

Input Specification:
First line of each input contains an integer T denoting the number of test cases.
First line of each test case contains an integer N denoting number of days for which Ken has to analyze.
Second line of each test case contains N space separated integer denoting gold price of each day

Output Specification:
For each test case print N space separated integers denoting the analysis the report.

Constrains:
1<=T<=100
1<=N<=105
1<=Pricei<=109

Sample Input
1
5
10 5 4 15 25

Sample Output
1 1 1 4 5 

Explanation
In this test case,
First day price was itself greater than or equal to its previous day. For first day ans=1.

For the second and third day, price is less than any previous day, so ans=1 for each of the day.

For the fourth day, price = 15 which is greater than all previous days, so ans=4

For the fifth day, price = 25 which is greater than all previous days, so ans=5.

So final answer for this test case is [1,1,1,4,5]

No Comments

Post A Comment