题解 | #数组中的逆序对#

数组中的逆序对

https://www.nowcoder.com/practice/96bd6684e04a44eb80e6a68efc0ec6c5

int InversePairs(int* data, int dataLen ) {
    // write code here
    int temp;
    int ii ,jj;
    long count=0;
    for(ii=0;ii<dataLen;ii++)
    {
        for(jj=ii+1;jj<dataLen;jj++)
        {
            if(data[ii]>data[jj])
            {
                count+=1;
            }
        }
    }
    printf("count=%d\n",count);
    return count%1000000007 ;//(int)(count-(int)(count/1000000007));//
}
全部评论
咋还打印了个printf
点赞 回复 分享
发布于 2022-08-27 00:05 北京

相关推荐

不愿透露姓名的神秘牛友
06-30 18:19
点赞 评论 收藏
分享
见见123:简历没有啥问题,是这个社会有问题。因为你刚毕业,没有工作经历,现在企业都不要没有工作经历的。社会病了。
点赞 评论 收藏
分享
评论
2
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务