7 kyu

Sort array by string length

24,858 of 50,396stevehopkinson

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 Trained73563
Total Skips7393
Total Code Submissions102925
Total Times Completed50396
JavaScript Completions24858
C# Completions2584
OCaml Completions159
C++ Completions3502
Python Completions16648
Ruby Completions1462
Scala Completions557
PHP Completions424
C Completions164
D Completions5
Rust Completions256
Go Completions597
CoffeeScript Completions11
Haskell Completions27
Total Stars525
% of votes with a positive feedback rating92% of 4635
Total "Very Satisfied" Votes3953
Total "Somewhat Satisfied" Votes598
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