牛客巅峰赛S2青铜组第十场B题

黄金组第B题
import java.util.*;
 
 
public class Solution {
    /**
     * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可
     *
     * @param n int整型
     * @param a int整型一维数组
     * @return int整型
     */
    public int wwork (int n, int[] a) {
        // write code here
        int minV = a[n - 1];
        int count = 0;
        for(int i = n - 1; i > 0; --i){
            if(a[i - 1] > minV){
                count++;
            }else{
                minV = a[i - 1];
            }
        }
        return count;
    }
}


#题解#
全部评论

相关推荐

点赞 评论 收藏
分享
每晚夜里独自颤抖:把华北改为华南再试一试,应该就没啥问题了。改完可能都不用投,别人主动联系了。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

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