The Toy Buildings (MEDIUM)

0

0 votes
Very-Easy
Problem

Little james is playing with his sister marry.Marry is a very sensitive girl,so every time she sees something which she doesn't likes, she becomes sad.
Now james and marry are playing together.The game is arranging the toy buildings.In this game james has to arrange the toy buildings in such a way that marry becomes happy .
Marry is only happy when the height of previous toy building is lesser than the next one.If such scenario occurs then she is happy.
Help james arrange the toy building in such a way that Marry is happy maximum times.

Constraints
1<=t<=1000
1<=n<=105
1<=ai<=105

Input
First lines contains t denoting number of testcases :
First line of each test contains n denoting number of toys.
Next line contains n space seperated integers.

Output
For each testcase , output maximum happiness that james can give to her sister.

Time Limit: 5
Memory Limit: 256
Source Limit:
Editor Image

?