7 kyu

Sort array by string length

25,208 of 51,295stevehopkinson

Description:

Write a function that takes an array of strings as an argument and returns a sorted array containing the same strings, ordered from shortest to longest.

For example, if this array were passed as an argument:

["Telescopes", "Glasses", "Eyes", "Monocles"]

Your function would return the following array:

["Eyes", "Glasses", "Monocles", "Telescopes"]

All of the strings in the array passed to your function will be different lengths, so you will not have to decide how to order multiple strings of the same length.

Sorting
Arrays
Fundamentals

Stats:

CreatedSep 27, 2016
PublishedSep 27, 2016
Warriors Trained74680
Total Skips7458
Total Code Submissions104400
Total Times Completed51295
JavaScript Completions25208
C# Completions2621
OCaml Completions161
C++ Completions3553
Python Completions17030
Ruby Completions1466
Scala Completions560
PHP Completions439
C Completions178
D Completions6
Rust Completions271
Go Completions646
CoffeeScript Completions11
Haskell Completions31
Total Stars528
% of votes with a positive feedback rating92% of 4670
Total "Very Satisfied" Votes3986
Total "Somewhat Satisfied" Votes600
Total "Not Satisfied" Votes84
Total Rank Assessments11
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • stevehopkinson Avatar
  • suic Avatar
  • smile67 Avatar
  • chrismamo1 Avatar
  • Chrono79 Avatar
  • Dentzil Avatar
  • kazk Avatar
  • user5036852 Avatar
  • JohanWiltink Avatar
  • janzaba Avatar
  • lilsweetcaligula Avatar
  • Cyhan Avatar
  • monadius Avatar
  • hobovsky Avatar
  • xavierguihot Avatar
  • trashy_incel Avatar
  • ejini战神 Avatar
  • akar-0 Avatar
  • tobeannouncd Avatar
  • therearedoors Avatar
  • KayleighWasTaken Avatar
Ad