7 kyu
Two Oldest Ages
8,688 of 35,372jhoffner
Description:
The two oldest ages function/method needs to be completed. It should take an array of numbers as its argument and return the two highest numbers within the array. The returned value should be an array in the format [second oldest age, oldest age]
.
The order of the numbers passed in could be any order. The array will always include at least 2 items. If there are two or more oldest age, then return both of them in array format.
For example (Input --> Output):
[1, 2, 10, 8] --> [8, 10]
[1, 5, 87, 45, 8, 8] --> [45, 87]
[1, 3, 10, 0]) --> [3, 10]
Arrays
Algorithms
Similar Kata:
Stats:
Created | Feb 16, 2013 |
Published | Mar 28, 2013 |
Warriors Trained | 52001 |
Total Skips | 2845 |
Total Code Submissions | 114411 |
Total Times Completed | 35372 |
JavaScript Completions | 11934 |
CoffeeScript Completions | 197 |
Ruby Completions | 1950 |
TypeScript Completions | 1657 |
Go Completions | 3218 |
Lua Completions | 577 |
Crystal Completions | 35 |
Elixir Completions | 519 |
C# Completions | 1252 |
Kotlin Completions | 2623 |
OCaml Completions | 130 |
Nim Completions | 57 |
Python Completions | 8688 |
CFML Completions | 23 |
Prolog Completions | 55 |
Julia Completions | 82 |
C Completions | 569 |
PHP Completions | 777 |
C++ Completions | 1509 |
Rust Completions | 439 |
R Completions | 258 |
Java Completions | 144 |
Total Stars | 274 |
% of votes with a positive feedback rating | 90% of 3790 |
Total "Very Satisfied" Votes | 3136 |
Total "Somewhat Satisfied" Votes | 585 |
Total "Not Satisfied" Votes | 69 |