7 kyu

Noonerize Me

771 of 1,599webtechalex

Description:

Spoonerize... with numbers... numberize?... numboonerize?... noonerize? ...anyway! If you don't yet know what a spoonerism is and haven't yet tried my spoonerism kata, please do check it out first.

You will create a function which takes an array of two positive integers, spoonerizes them, and returns the positive difference between them as a single number or 0 if the numbers are equal:

[123, 456] = 423 - 156 = 267

Your code must test that all array items are numbers and return "invalid array" if it finds that either item is not a number. The provided array will always contain 2 elements.

When the inputs are valid, they will always be integers, no floats will be passed. However, you must take into account that the numbers will be of varying magnitude, between and within test cases.

Mathematics
Arrays
Algorithms

More By Author:

Check out these other kata created by webtechalex

Stats:

CreatedMar 6, 2016
PublishedMar 6, 2016
Warriors Trained2733
Total Skips25
Total Code Submissions6948
Total Times Completed1599
JavaScript Completions771
Python Completions801
Ruby Completions72
Total Stars27
% of votes with a positive feedback rating88% of 308
Total "Very Satisfied" Votes250
Total "Somewhat Satisfied" Votes40
Total "Not Satisfied" Votes18
Total Rank Assessments14
Average Assessed Rank
7 kyu
Highest Assessed Rank
6 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • webtechalex Avatar
  • GiacomoSorbi Avatar
  • Wei-Ting Yang Avatar
  • Just4FunCoder Avatar
  • saudiGuy Avatar
Ad