Geeksforgeeks

Error

×

Leaderboard

Showing:

Handle | Score |
---|---|

@Ibrahim Nash | 5725 |

@blackshadows | 5685 |

@akhayrutdinov | 5111 |

@mb1973 | 4989 |

@Quandray | 4908 |

@saiujwal13083 | 4156 |

@sanjay05 | 3762 |

@marius_valentin_dragoi | 3511 |

@sushant_a | 3453 |

@KshamaGupta | 3318 |

@the_coder95 | 3302 |

Complete Leaderboard | |

Handle | Score |

@avaiesshaik782 | 662 |

@arpitsatnalika | 629 |

@code_it_ | 591 |

@prakharxyz | 583 |

@tujhekya | 542 |

@Rahul Jadhav 1 | 458 |

@sivanandh03 | 448 |

@satyam0460 | 433 |

@iamronak | 424 |

@imnm | 424 |

@18eumc107 | 421 |

Complete Leaderboard |

Given are the heights of certain Buildings which lie adjacent to each other. Sunlight starts falling from left side of the buildings. If there is a building of certain Height, all the buildings to the right side of it having lesser heights cannot see the sun . The task is to find the total number of such buildings that receive sunlight.

**Input**:

First Line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case consists of two lines. First line of each test case contains an integer N denoting the number of buildings. Second line contains N space separated integers H_{1}, H_{2},...H_{N} denoting heights of buildings.

**Output:**

Corresponding to each test case, print the desired output in a new line

**Constraints:**

1<=T<=100

1<=N<=100

1<=H_{i}<=100

**Example:**

**Input:**

3

6

6 2 8 4 11 13

5

2 5 1 8 3

7

3 4 1 0 6 2 3

**Output:**

4

3

3

**Explanation:**

In the first example only buildings of height 6 8 11 and 13 can see the sun, hence output is 4.

Login to report an issue on this page.

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

Yes
Buildings receiving sunlight

...

Please choose 'ReadOnlyMode' if you needn't to 'Edit' the problem e.g. viewing OJ's solution, TestCase Files (TCFs), TimeLimit etc.