Tall Tales
Description:
You're queued for lunch at the Hooli cafeteria, eagerly anticipating the special of the day: Organic, grass-fed, free-range chicken breast with a side of kale (mmm).
All of a sudden, the fire alarm goes off and you all race outside. Breathing a sigh of relief as you realize it was just a drill, you head back to the cafeteria. As an egalitarian, meritocratic future company (tm), you and your coworkers are committed to restoring the correct order of the line. Problem is, you don't remember your number in line.
What you DO know is how many people in front of you were at least as tall as you (f) and your own height (h) in centimeters.
So your properties will looks something like this, where both n and k are guaranteed to be nonnegative integers.
{
h: 195,
f: 3
}
Given a list of employees with such properties, find the correct ordering of the line. Any employee with f = x should be behind exactly x other employees.
// Given this
var unordered = [{h: 200, f: 1}, {h: 185, f: 2}, {h: 190, f: 0}, {h: 175, f: 4}, {h: 190, f: 2}, {h: 200, f: 0}]
// End up with this
var ordered = [{h: 190, f: 0}, {h: 200, f: 0}, {h: 185, f: 2}, {h: 190, f: 2}, {h: 175, f: 4}, {h: 200, f: 1}]
Similar Kata:
Stats:
Created | Oct 25, 2016 |
Published | Oct 25, 2016 |
Warriors Trained | 84 |
Total Skips | 36 |
Total Code Submissions | 141 |
Total Times Completed | 15 |
JavaScript Completions | 15 |
Total Stars | 6 |
% of votes with a positive feedback rating | 81% of 8 |
Total "Very Satisfied" Votes | 6 |
Total "Somewhat Satisfied" Votes | 1 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 7 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 6 kyu |