Tap here to switch tabs
Problem
Submissions

Problem: Height Checker

med
30 min
Try to solve the Height Checker problem.

Statement

A school is trying to arrange students in nondecreasing order of their heights. You are given an integer array heights representing the current order of the students.

Let expected be the array representing heights sorted in nondecreasing order.

Return the total number of indices i where heights[i] \neq expected[i].

Constraints:

  • 1≤1 \leq heights.length ≤100\leq 100

  • 1≤1 \leq heights[i] ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Height Checker

med
30 min
Try to solve the Height Checker problem.

Statement

A school is trying to arrange students in nondecreasing order of their heights. You are given an integer array heights representing the current order of the students.

Let expected be the array representing heights sorted in nondecreasing order.

Return the total number of indices i where heights[i] \neq expected[i].

Constraints:

  • 1≤1 \leq heights.length ≤100\leq 100

  • 1≤1 \leq heights[i] ≤100\leq 100