8 kyu
To square(root) or not to square(root)
9,083 of 34,561user5036852
Description:
Write a method, that will get an integer array as parameter and will process every number from this array.
Return a new array with processing every number of the input-array like this:
If the number has an integer square root, take this, otherwise square the number.
Example
[4,3,9,7,2,1] -> [2,9,3,49,4,1]
Notes
The input array will always contain only positive numbers, and will never be empty or null.
Mathematics
Arrays
Algorithms
Similar Kata:
Stats:
Created | Oct 6, 2016 |
Published | Oct 6, 2016 |
Warriors Trained | 51847 |
Total Skips | 1232 |
Total Code Submissions | 91014 |
Total Times Completed | 34561 |
C# Completions | 1593 |
Java Completions | 3982 |
JavaScript Completions | 14335 |
F# Completions | 120 |
Python Completions | 9083 |
TypeScript Completions | 631 |
Ruby Completions | 830 |
CoffeeScript Completions | 25 |
C Completions | 1125 |
Crystal Completions | 26 |
Go Completions | 1347 |
Swift Completions | 1282 |
PHP Completions | 823 |
Haskell Completions | 83 |
COBOL Completions | 10 |
λ Calculus Completions | 8 |
Julia Completions | 22 |
Rust Completions | 245 |
D Completions | 12 |
C++ Completions | 582 |
Total Stars | 465 |
% of votes with a positive feedback rating | 93% of 4323 |
Total "Very Satisfied" Votes | 3777 |
Total "Somewhat Satisfied" Votes | 482 |
Total "Not Satisfied" Votes | 64 |
Total Rank Assessments | 12 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 8 kyu |