Smart Number 2

  • + 0 comments

    C++ solution

    bool is_smart_number(int num) {
        int val = (int) sqrt(num);
        if(num==1 || (num>=4 && val>1 && num == val*val))
            return true;
        return false;
    }