Queue Reconstruction by Height | LeetCode 406 | Programming Tutorials

preview_player
Показать описание
In this tutorial, I have explained Queue Reconstruction by Height LeetCode Problem. We have to arrange list of people by h and k where
h denotes height of a person and k represents the number of people in front of this person who have a height greater than or equal to h.

Important Points Related to Question -

i) Given a Random list of people standing in a queue.
ii) Each person is described by a pair of integers (h, k).
h - It represents the height of a person
k - Represents the number of people in front of this person who have a height greater than or equal to h.

We have to write an algorithm to reconstruct the queue.

For Example -

Input: [[7,0], [4,4], [7,1], [5,0], [6,1], [5,2]]

Output: [[5,0], [7,0], [5,2], [6,1], [4,4], [7,1]]


Queue Reconstruction by Height Java Code.
LeetCode June Challenge Day 6

Рекомендации по теме
Комментарии
Автор

Good explanation. I got the solution finally here after watching so many other vidoes on this problem. Thank you!

reyazahmed
Автор

Good one, The June challenge is tougher than April and May challenge.

sushmasinghSS
Автор

Good one. After sorting why we use k as a index value. I also think the value of k is never greater than are.length-1.

bikramasingh
join shbcf.ru