title | date | tags | domain |
---|---|---|---|
Task 20 ( 12th NOV 2022 ) |
2022-11-11 16:00:00 -0800 |
Problem of the day week 3 |
CP |
Every day we will be giving you one problem to solve from the easy level and will increase the difficulty day by day. Problems will be published on the Hackerrank website to submit your solution to the problem, follow the given steps:
- Create an account on hackerrank website ( If already have an account, leave this step).
- Link the problem link which will be provided below.
- Read and solve the problem and submit your solution there.
- If you have doubts regarding the problem or you got stuck, you can contact the mentor assigned to you.
Racoon City after being completely annihilated has to be rebuilt in a specific order of building heights keeping in mind the older situations because of the apocalypse. So the engineers want a design where the height of all the buildings is chosen by the residents. Then the engineers decide a center point and all the buildings are built around that center point in descending order based on the heights. Design a code to arrange all the heights given into an array with the max height at the specified index and all other elements surrounding it reducing in height. The 2nd highest building always comes to the right of the highest building.
Input Format
The first line contains a single integer T containing the number of test cases. T lines follow The first line of each test case gives the size of the array of heights N and the index of the highest building i. The next line contains the unsorted array containing the heights H of all the residents
Link for the problem : https://www.hackerrank.com/problem-of-the-day-week-3
All the best ✨