# Puzzle: Sort Out The Men From Boys \[reference\]

**URL:** <https://forum.codeselfstudy.com/t/puzzle-sort-out-the-men-from-boys-reference/2479>\
**Category:** Puzzles and Logic\
**Created:** [November 4, 2020, 9:47am UTC](https://forum.codeselfstudy.com/t/puzzle-sort-out-the-men-from-boys-reference/2479 "2020-11-04T09:47:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![content\_bot](https://forum.codeselfstudy.com/letter_avatar_proxy/v4/letter/c/9d8465/32.png) [@content\_bot](https://forum.codeselfstudy.com/u/content_bot)\
**Post date:** [November 4, 2020, 9:47am UTC](https://forum.codeselfstudy.com/t/puzzle-sort-out-the-men-from-boys-reference/2479/1 "2020-11-04T09:47:12Z")

</div>

“\*\*Sort Out The Men From Boys \*\*” is a coding puzzle that people can be attempted in the following languages: cpp, javascript, ruby, crystal, python, haskell, c, java, php, dart, julia, typescript, coffeescript, reason, elixir, racket, clojure, csharp, prolog, and cfml.

- **Difficulty:** 7 kyu
- **Stars:** 110
- **Votes:** 714
- **Category:** reference
- **Tags:** Fundamentals, Numbers, Data Types, Basic Language Features, Conditional Statements, Control Flow, Algorithms, Logic
- **Source:** [codewars](https://www.codewars.com/kata/5af15a37de4c7f223e00012d)

# Description

# Scenario

_Now that the competition gets tough it will_ **_Sort out the men from the boys_**.

**_Men_** are the **_Even numbers_** and **_Boys_** are the **_odd_**![!alt](https://forum.codeselfstudy.com/uploads/default/original/2X/6/6dbda79e43880630032fb431b60cd3d908c1518f.png) ![!alt](https://forum.codeselfstudy.com/uploads/default/original/2X/6/6dbda79e43880630032fb431b60cd3d908c1518f.png)

* * *

# Task

**_Given_** an _array/list [] of n integers_ , **_Separate_** _The even numbers from the odds_ , or **_Separate_**** _the men from the boys_**![!alt](https://forum.codeselfstudy.com/uploads/default/original/2X/6/6dbda79e43880630032fb431b60cd3d908c1518f.png) ![!alt](https://forum.codeselfstudy.com/uploads/default/original/2X/6/6dbda79e43880630032fb431b60cd3d908c1518f.png)

* * *

# Notes

- **_Return_** _an array/list where_ **_Even numbers_**  **_come first then odds_**

- Since , **_Men are stronger than Boys_** , _Then_ **_Even numbers_** in **_ascending order_** While **_odds in descending_**.

- **_Array/list_** size is _at least **4** _ .

- **_Array/list_** numbers could be a _mixture of positives , negatives_ .

- **_Have no fear_** , _It is guaranteed that no Zeroes will exists_ . ![!alt](https://forum.codeselfstudy.com/uploads/default/original/2X/6/6dbda79e43880630032fb431b60cd3d908c1518f.png)

- **_Repetition_** of numbers in _the array/list could occur_ , So **_(duplications are not included when separating)_**.

* * *

# Input \>\> Output Examples:

```auto

menFromBoys ({7, 3 , 14 , 17}) ==&gt; return ({14, 17, 7, 3})

```

## **_Explanation_** :

**_Since_** , `{ 14 }` is the **_even number_** here , So it **_came first_** , **_then_** _the odds in descending order_ `{17 , 7 , 3}` .

* * *

```auto

menFromBoys ({-94, -99 , -100 , -99 , -96 , -99 }) ==&gt; return ({-100 , -96 , -94 , -99})

```

## **_Explanation_** :

- **_Since_** , `{ -100, -96 , -94 }` is the **_even numbers_** here , So it **_came first_** in \*ascending order \*, **_then_** _the odds in descending order_ `{ -99 }`

- **_Since_** , **_(Duplications are not included when separating)_** , _then_ you can see **_only one (-99)_** _was appeared in the final array/list_ .

* * *

```auto

menFromBoys ({49 , 818 , -282 , 900 , 928 , 281 , -282 , -1 }) ==&gt; return ({-282 , 818 , 900 , 928 , 281 , 49 , -1})

```

## **_Explanation_** :

- **_Since_** , `{-282 , 818 , 900 , 928 }` is the **_even numbers_** here , So it **_came first_** in _ascending order_ , **_then_** _the odds in descending order_ `{ 281 , 49 , -1 }`

- **_Since_** , **_(Duplications are not included when separating)_** , _then_ you can see **_only one (-282)_** _was appeared in the final array/list_ .

* * *

* * *

* * *

# [Playing with Numbers Series](https://www.codewars.com/collections/playing-with-numbers)

# [Playing With Lists/Arrays Series](https://www.codewars.com/collections/playing-with-lists-slash-arrays)

# [Bizarre Sorting-katas](https://www.codewars.com/collections/bizarre-sorting-katas)

# [For More Enjoyable Katas](http://www.codewars.com/users/MrZizoScream/authored)

* * *

## ALL translations are welcomed

## Enjoy Learning !!

# Zizou

# Solve It Here

Click the link below to solve it on Codewars:

> **[Sort Out The Men From Boys](https://www.codewars.com/kata/5af15a37de4c7f223e00012d)**
>
> Scenario 
> Now that the competition gets tough it will Sort out the men from the boys . 
> Men are the Even numbers and Boys are the odd     
>  
> Task 
> Given an array/list \[\] of n integers , Separat...

# Notes

This puzzle was posted by a Slackbot via a slash command. If you want to help work on the app, send a message to @Josh.

If you don’t want to see the coding puzzles when you visit the forum, you can go into [your settings](https://forum.codeselfstudy.com/my/preferences/categories) and mute the puzzles category.
