Share your repls and programming experiences

← Back to all posts
perfectSquare
kingTalent (4)

Write a function called isSquare() that takes a number and tells if the number is a perfectsquare or not.

Comments
hotnewtop
jimxin2595 (19)

why tho, this is easy....

timmy_i_chen (1180)

@kingTalent Is it for your interview? ;) Do you have a solution for it?

timmy_i_chen (1180)

@kingTalent Nice! I think there might be a way to solve this without loops - what do you think?

kingTalent (4)

@timmy_i_chen yes there is.... this method seems more accurate

timmy_i_chen (1180)

@kingTalent I can think of a method that is equally accurate, but doesn't require loops (not as computationally expensive. e.g. if i fed the program a 20-digit number it might take a while to get there!

kingTalent (4)

@timmy_i_chen you can give it a try...

timmy_i_chen (1180)

@kingTalent Was hoping I could get you to try it, but here it is: https://repl.it/@timmy_i_chen/isSquare

kingTalent (4)

@timmy_i_chen this is acually a wrong method for checking for perfect squares.. actually forgot the issue with this method .. but i am sure its not the best approach

timmy_i_chen (1180)

@kingTalent Por que? Would love to hear why!

kingTalent (4)

@timmy_i_chen i forgot why,but check any online resource,this method is not advisable