We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Algorithms
- Debugging
- Smart Number
- Discussions
Smart Number
Smart Number
Sort by
recency
|
126 Discussions
|
Please Login in order to post a comment
Here is my c++ solution, you can watch video explanation here : https://youtu.be/Qs9rxqfzTs8
For Java coders: change line 10 to:
A smart number is only smart if its a perfect square.
bool is_smart_number(int num) { if(num<=0) return false;
}
Its correct but compiling false
Why this problem doesnt support JavaScript language
import java.io.; import java.util.; import java.text.; import java.math.; import java.util.regex.*;
public class Solution { public static boolean isSmartNumber(int num) { int val = (int) Math.sqrt(num);
if(num / val == 1) return true; return false; }
}