Sum of Square Numbers (Easy LinkedIn)
Input: 5
Output: True
Explanation: 1 * 1 + 2 * 2 = 5Input: 3
Output: FalseBasic Idea:
typedef long long ll; class Solution { public: bool judgeSquareSum(int c) { for (ll i = 0; i * i <= c; ++i) { int t = c - i * i; int sq = (int)sqrt(t); if (sq * sq == t) return true; } return false; } };