Title: DSA C++ Day 33: Conquering LeetCode's "Height Checker" Challenge
The "Height Checker" problem revolves around arranging a list of students in non-decreasing order of their heights and then determining the number of students who are not in the correct positions. This seemed like a perfect test for my sorting and algorithmic skills, so I eagerly dived in.
I started by creating a copy of the original height array and sorting it in non-decreasing order. Then, I compared each corresponding pair of elements in the original and sorted arrays. If they were not equal, I incremented a counter. This counter represented the number of students in incorrect positions.