GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Wednesday, 13 July 2022

[Solution] Similar Heights Codechef Solution


Chef is teaching his class of N students at Hogwarts. He groups students with the same height together for an activity. Some of the students end up in a groups with only themselves and are saddened by this.

With the help of his magic wand, Chef can increase the height of any student to any value he likes. Now Chef wonders, what is the minimum number of students whose height needs to be increased so that there are no sad students?

Input Format

  • The first line of input will contain a single integer T, denoting the number of test cases.
Solution Click Below:-  👉CLICK HERE👈
👇👇👇👇👇


  • Each test case consists of two lines of input.
    • The first line of each test case contains one integer N — the number of students.
    • The second line consists of N space-separated integers H1,H2,,HN denoting the heights
    •  of the students.










Output Format

For each test case, output on a single line the minimum number of students whose heights must to be increased.

Constraints

  • 1T5104
  • 2N105
  • 1Hi109
  • The sum of N over all test cases won't exceed 3105.

No comments:

Post a Comment