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

Stats:

CreatedOct 6, 2016
PublishedOct 6, 2016
Warriors Trained51418
Total Skips1223
Total Code Submissions90140
Total Times Completed34194
C# Completions1578
Java Completions3943
JavaScript Completions14207
F# Completions117
Python Completions8977
TypeScript Completions617
Ruby Completions825
CoffeeScript Completions24
C Completions1112
Crystal Completions25
Go Completions1327
Swift Completions1268
PHP Completions812
Haskell Completions81
COBOL Completions10
λ Calculus Completions7
Julia Completions21
Rust Completions240
D Completions11
C++ Completions542
Total Stars462
% of votes with a positive feedback rating93% of 4301
Total "Very Satisfied" Votes3755
Total "Somewhat Satisfied" Votes482
Total "Not Satisfied" Votes64
Total Rank Assessments12
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • user5036852 Avatar
  • GiacomoSorbi Avatar
  • SithFire Avatar
  • suic Avatar
  • Chrono79 Avatar
  • naithar Avatar
  • Dentzil Avatar
  • JohanWiltink Avatar
  • leometzger Avatar
  • Voile Avatar
  • hobovsky Avatar
  • MikChan Avatar
  • ejini战神 Avatar
  • akar-0 Avatar
  • Kacarott Avatar
  • o2001 Avatar
Ad