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
+ 0 comments ****Solution for java
since variable int is used,so on checking num variable,it should also be checked in integer type variable,so as on dividing we get some decimal value,i.e. ,an error.
****So,check if(num==val*val)
+ 0 comments Here is Smart Number problem solution in Python Java C++ and C programming - https://programs.programmingoneonone.com/2021/07/hackerrank-smart-number-problem-solution.html
+ 0 comments There is a bug in Java code, try using python, it passes all the test cases for the same changes made.
+ 0 comments Perfect Squares have odd number of factors.
def is_smart_number(num): val = int(math.sqrt(num)) if num == val*val: return True return False
+ 0 comments Java
public static boolean isSmartNumber(int num) { int val = (int) Math.sqrt(num); if(num / val == val) return true; return false; }
Load more conversations
Sort 106 Discussions, By:
Please Login in order to post a comment