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:

CreatedDec 19, 2017
Warriors Trained15
Total Skips0
Total Code Submissions37
Total Times Completed7
JavaScript Completions7
Total Stars0
% of votes with a positive feedback rating50% of 4
Total "Very Satisfied" Votes2
Total "Somewhat Satisfied" Votes0
Total "Not Satisfied" Votes2
Total Rank Assessments3
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
7 kyu
Ad
Contributors
  • Dmitry Kudla Avatar
Ad