633 Sum of Square Numbers
1. Question
Given a non-negative integerc
, your task is to decide whether there're two integersa
andb
such that a2+ b2= c.
Example 1:
Example 2:
2. Implementation
(1) Binary Search
3. Time & Space Complexity
Binary Search: 时间复杂度Sqrt(n) * log(Sqrt(n)), n为输入的数字,空间复杂度O(1)
Last updated