8 kyu
To square(root) or not to square(root)
1,578 of 34,194user5036852
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 | 51418 |
Total Skips | 1223 |
Total Code Submissions | 90140 |
Total Times Completed | 34194 |
C# Completions | 1578 |
Java Completions | 3943 |
JavaScript Completions | 14207 |
F# Completions | 117 |
Python Completions | 8977 |
TypeScript Completions | 617 |
Ruby Completions | 825 |
CoffeeScript Completions | 24 |
C Completions | 1112 |
Crystal Completions | 25 |
Go Completions | 1327 |
Swift Completions | 1268 |
PHP Completions | 812 |
Haskell Completions | 81 |
COBOL Completions | 10 |
λ Calculus Completions | 7 |
Julia Completions | 21 |
Rust Completions | 240 |
D Completions | 11 |
C++ Completions | 542 |
Total Stars | 462 |
% of votes with a positive feedback rating | 93% of 4301 |
Total "Very Satisfied" Votes | 3755 |
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 |