Menu

[solved]-Need Java Code Problem Rash Known Love Racing Sports Avid Formula 1 Fan Went Watch Year S Q39000381

I need a java code for this problem.

Rash is known about his love for racing sports. He is an avidFormula 1 fan. He went to watch this year’s Indian GrandPrix at New Delhi. He noticed that one segment of the circuit was along straight road. It was impossible for a car to overtake othercars on this segment. Therefore, a car had to lower down its speedif there was a slower car in front of it. While watching the race,Rash started to wonder how many cars were moving at their maximumspeed. Formally, you’re given the maximum speed of N carsin the order they entered the long straight segment of the circuit.Each car will prefers to move at its maximum speed. If that’s notpossible because of the front car being slow, it might have tolower its speed. It still moves at the fastest possible speed whileavoiding any collisions. For the purpose of this problem, you canassume that the straight segment is infinitely long. Count thenumber of cars which were moving at their maximum speed on thestraight segment.

Input

The first line of the input contains a single integer Tdenoting the number of test cases to follow. Description of eachtest case contains 2 lines. The first of these linescontain a single integer N, the number of cars. The secondline contains N space separated integers, denoting themaximum speed of the cars in the order they entered the longstraight segment.

Output

For each test case, output a single line containing the numberof cars which were moving at their maximum speed on thesegment.

Constraints

1≤T≤100
1≤N≤105
1≤speed≤109

SAMPLE INPUT

311038 3 654 5 1 2 3

SAMPLE OUTPUT

122

Expert Answer


Answer to I need a java code for this problem. Rash is known about his love for racing sports. He is an avid Formula 1 fan. He wen… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *