Skip to content

1051. Height Checker #213

Answered by mah-shamim
mah-shamim asked this question in Q&A
Aug 1, 2024 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

The problem at hand is to calculate the number of indices where the heights of students in a photo do not match the expected order. The students are supposed to be arranged in non-decreasing order by height. We are given the current arrangement and need to compare it with the expected arrangement to count how many students are out of place.

Key Points:

  • We need to return the number of indices where the current height does not match the expected height.
  • The input is an array representing the current height order.
  • The expected order is simply the sorted version of the input array.

Approach:

  1. Sorting the Heights: First, we need to generate the expected order, which is just the sorted versio…

Replies: 1 comment 2 replies

Comment options

mah-shamim
Jan 2, 2025
Maintainer Author

You must be logged in to vote
2 replies
@basharul-siddike
Comment options

@mah-shamim
Comment options

mah-shamim Jan 2, 2025
Maintainer Author

Answer selected by basharul-siddike
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested easy Difficulty
2 participants