All Posts
Leetcode 1996: The Number of Weak Characters in the Game
You are given a list of characters’ properties, where each character has two main attributes: attack and defense. A character is weak if another character exists with both greater attack and defense values. Return the number of weak characters in the list.
Leetcode 2104: Sum of Subarray Ranges
You are given an integer array nums
. A subarray of nums
is a contiguous sequence of elements. The range of a subarray is defined as the difference between the maximum and minimum elements within that subarray.
Your task is to calculate the sum of the ranges for all possible subarrays in the given array nums
.