题目描述: Problem Description The Children’s Day has passed for some days .Has you remembered something happened at your childhood? I remembered I often played a game called hide handkerchief with my fr
题目链接: 力扣https://leetcode-cn.com/problems/sum-of-subarray-ranges/ 【分析】目前我想到的是通过两层循环,遍历的时候记住当前的最大值和最小值,然后累加最大值的最小值的差。虽然复杂度位O(n),但是也能过。 class Solution {public long subArrayRanges(int[] nums) {int n