TORONTO KIDS COMPUTER CLUB | PMCA Sunday 10:00 Practice -03.28
post-template-default,single,single-post,postid-19223,single-format-standard,ajax_fade,page_not_loaded,,qode-theme-ver-7.6.2,wpb-js-composer js-comp-ver-6.10.0,vc_responsive

PMCA Sunday 10:00 Practice -03.28

30 Mar PMCA Sunday 10:00 Practice -03.28

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.


Sample Input
10 5 4 15 25

Sample Output
1 1 1 4 5 

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

Sorry, the comment form is closed at this time.