这题...有点简单吧,为什么只有34%的通过率?

题目意思简单说就是查找index,或者按升序插入的未知,WA一次,罪过,下次要特别注意程序里变量的变化,提交前用样例检查。

简单的我有点不好意思贴代码,实话..

class Solution {
public:
    int searchInsert(int A[], int n, int target) {
        int i = 0;
        for (i = 0; i<n; ++i)
        {
            if (target <= A[i]) return i;
        }
        return i;
    }
};

相关文章:

  • 2021-08-30
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-02-14
  • 2021-07-29
相关资源
相似解决方案