7 kyu

Sort rectangles and circles by area

Description:

In this kata you will be given an array of the dimensions of rectangles (array with width and length) and circles (radius - just a number). Your task is to sort the objects by their area in ascending order and return the sorted array of areas. Round the values of the areas to a maximum of two decimal places.

For example,

var array = [[4.23, 6.43], 1.23, 3.444, [1.342, 3.212]];  // [rectangle, circle, circle, reactangle]
sortByArea(array); // should return [ 4.31, 4.75, 27.2, 37.26 ]
Mathematics
Geometry
Fundamentals
Algorithms
Sorting

Stats:

CreatedNov 28, 2017
PublishedNov 29, 2017
Warriors Trained676
Total Skips2
Total Code Submissions921
Total Times Completed371
JavaScript Completions371
Total Stars7
% of votes with a positive feedback rating90% of 110
Total "Very Satisfied" Votes90
Total "Somewhat Satisfied" Votes17
Total "Not Satisfied" Votes3
Total Rank Assessments3
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • c4asma Avatar
  • Voile Avatar
Ad