欧美1区2区3区激情无套,两个女人互添下身视频在线观看,久久av无码精品人妻系列,久久精品噜噜噜成人,末发育娇小性色xxxx

兩數(shù)之和

int twoSum(const int nums[], const int n, const int target, std::vector<int>& result)
{
    result.clear();
    if (n < 2) return -1;

    const int* left, * right;
    left = nums;
    right = nums + n - 1;

    while (left < right)
    {
        const int sum = (*left + *right);
        if (sum == target)
        {
            result.push_back(left - nums);
            result.push_back(right - nums);
            return 0;
        }
        if (sum < target) left++;
        else right--;
    }

    return -1;
}


int twoSumV2(const int nums[], const int n, const int target, std::vector<int>& result)
{
    result.clear();
    if (n < 2) return -1;

    for (int i = 0; i < n - 1; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            const int sum = nums[i] + nums[j];
            if (sum == target)
            {
                result.push_back(i);
                result.push_back(j);
                return 0;
            }
        }
    }

    return -1;
}

全部評(píng)論

相關(guān)推薦

不愿透露姓名的神秘牛友
05-01 13:13
ecece:這么明目張膽虛報(bào)就業(yè)率啊
點(diǎn)贊 評(píng)論 收藏
分享
評(píng)論
點(diǎn)贊
收藏
分享

創(chuàng)作者周榜

更多
??途W(wǎng)
??推髽I(yè)服務(wù)