Bored ?

5

2 votes
Very-Easy
Problem

"People have died" -Sherlock

“That’s what people do!” -Moriarty

Problem 2

Given a list of N numbers, your task is to find the number of indices the maximum number will have to move in order to reach end of list.

Note: In case of multiple occurrences of maximum number, consider its first position.

Input:

The first line of input contains an integer T denoting the number of test cases.

First line of test case contains a single integer N.

Second line of test case contains the list of N numbers.

Output:

For each test case, print the required answer in a new line.

Constraints:

1T100

1N100

0 list elements 100

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Given list: 3 5 2 4 2, the maximum number in list is 5 , it will take 3 steps to reach the end of list.

Editor Image

?