Little Ashish's Huge Donation

  • + 0 comments

    c++ almost complete all test cases

    int solve(long x) {
        long total = 0;
        int i = 1;
        while(true){
            total += (i * i);
            if(total>x){
                break;
            }
            i++;
        }
        return --i;
    }