牛客巅峰赛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;
    }
}


#题解#
全部评论

相关推荐

点赞 评论 收藏
转发
点赞 收藏 评论
分享
牛客网
牛客企业服务