chyblogs

平方数之和

 1 class Solution {
 2     public boolean judgeSquareSum(int c) {
 3         int i=0;
 4         int j=(int)(Math.sqrt(c));
 5         while(i<=j){
 6             if(i*i+j*j==c) return true;
 7             else if(i*i+j*j>c){
 8                 j--;
 9             }
10             else{
11                 i++;
12             }
13         }
14         return false;
15     }
16 }

还是双指针

分类:

技术点:

相关文章:

  • 2021-08-02
  • 2021-10-03
  • 2022-01-04
  • 2021-12-21
  • 2022-12-23
  • 2021-12-29
  • 2021-07-31
  • 2021-12-05
猜你喜欢
  • 2021-04-13
  • 2021-12-04
  • 2022-02-08
  • 2021-11-24
  • 2021-04-26
  • 2021-09-18
  • 2022-12-23
相关资源
相似解决方案