Draft
Get girls shortlist
Description:
My name is Albert, I am 23 years old, and in the end I work hard in IT company. So I have no much time to flirt with many girls and I want to choose the best of those I know, or in other words, I need to create a shortlist of them.
Input:
- an array
longlist
where each element is an object with a description of specific girl. topNumber
is a number of top girls I need.
Output:
- a new array with filtered
topNumber
girls (actually objects) that are sorted in the same order as my tastes below.
So what do I like about girls:
- she doesn't have children
- she is the younger (
longlist
includs 21+ ) - she is the taller
- she lives in the same city
- if all the previous equals sort them by name in alphabetical order
For Example:
input:
longlist == [{
'name': 'Jesica',
'children': 1,
'age': 18,
'height': '180.3cm',
'theSameCity': true
},
{
'name': 'Klara',
'children': 0,
'age': 19,
'height': '165.2cm',
'theSameCity': true
},
{
'name': 'Monica',
'children': 0,
'age': 19,
'height': '175.0cm',
'theSameCity': false
}]
topNumber == 2
ouput:
[{
'name': 'Monica',
'children': 0,
'age': 19,
'height': '175.0cm',
'theSameCity': false
},
{
'name': 'Klara',
'children': 0,
'age': 19,
'height': '165.2cm',
'theSameCity': true
}]
P.S. I'm a sociable guy, so the input array will always have more than 20 objects, the same structure and it will be correct as one above.
topNumber
< longlistl.ength
Fundamentals
Arrays
Similar Kata:
Stats:
Created | Dec 19, 2017 |
Warriors Trained | 15 |
Total Skips | 0 |
Total Code Submissions | 37 |
Total Times Completed | 7 |
JavaScript Completions | 7 |
Total Stars | 0 |
% of votes with a positive feedback rating | 50% of 4 |
Total "Very Satisfied" Votes | 2 |
Total "Somewhat Satisfied" Votes | 0 |
Total "Not Satisfied" Votes | 2 |
Total Rank Assessments | 3 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 7 kyu |