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.
  • Hackerrank Home
  • Prepare
    NEW
  • Certify
  • Compete
  • Career Fair
  • Hiring developers?
  1. Prepare
  2. Algorithms
  3. Debugging
  4. Smart Number
  5. Discussions

Smart Number

Problem
Submissions
Leaderboard
Discussions

Sort 106 Discussions, By:

recency

Please Login in order to post a comment

  • utsavbaranwal224
    2 months ago+ 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)

    -4|
    Permalink
  • yashdeora98294
    2 months ago+ 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

    1|
    Permalink
  • ipsita2811
    4 months ago+ 0 comments

    There is a bug in Java code, try using python, it passes all the test cases for the same changes made.

    0|
    Permalink
  • mustafeez0001
    5 months ago+ 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
    
    -2|
    Permalink
  • rajukumar7
    6 months ago+ 0 comments

    Java

    public static boolean isSmartNumber(int num) {
            int val = (int) Math.sqrt(num);    
            if(num / val == val)
                return true;
            return false;
        }
    
    -1|
    Permalink
Load more conversations

Need Help?


View top submissions
  • Blog
  • Scoring
  • Environment
  • FAQ
  • About Us
  • Support
  • Careers
  • Terms Of Service
  • Privacy Policy