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

Stats:

CreatedFeb 16, 2013
PublishedMar 28, 2013
Warriors Trained52001
Total Skips2845
Total Code Submissions114411
Total Times Completed35372
JavaScript Completions11934
CoffeeScript Completions197
Ruby Completions1950
TypeScript Completions1657
Go Completions3218
Lua Completions577
Crystal Completions35
Elixir Completions519
C# Completions1252
Kotlin Completions2623
OCaml Completions130
Nim Completions57
Python Completions8688
CFML Completions23
Prolog Completions55
Julia Completions82
C Completions569
PHP Completions777
C++ Completions1509
Rust Completions439
R Completions258
Java Completions144
Total Stars274
% of votes with a positive feedback rating90% of 3790
Total "Very Satisfied" Votes3136
Total "Somewhat Satisfied" Votes585
Total "Not Satisfied" Votes69
Ad
Contributors
  • jhoffner Avatar
  • GiacomoSorbi Avatar
  • kissgege Avatar
  • anter69 Avatar
  • 10XL Avatar
  • kazk Avatar
  • B1ts Avatar
  • barakplasma Avatar
  • Voile Avatar
  • Madjosz Avatar
  • richkotze Avatar
  • Souzooka Avatar
  • rowcased Avatar
  • metagn Avatar
  • clcraig Avatar
  • monadius Avatar
  • konkath Avatar
  • hobovsky Avatar
  • stellartux Avatar
  • user8436785 Avatar
  • user7147914 Avatar
  • ejini战神 Avatar
  • akar-0 Avatar
Ad