259. 3Sum Smaller

259. 3Sum Smaller Given an array of n integers nums and an integer target, find the number of index triplets i, j, k with 0 <= i < j < k < n that satisfy the condition nums[i] + nums[j] + nums[k] < target. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 Example 1: Input: nums = [-2,0,1,3], target = 2 Output: 2 Explanation: Because there are two triplets which sums are less than 2: [-2,0,1] [-2,0,3] Example 2: Input: nums = [], target = 0 Output: 0 Example 3: Input: nums = [0], target = 0 Output: 0 Constraints:...

<span title='2021-09-09 00:00:00 +0000 UTC'>September 9, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

315. Count of Smaller Numbers After Self

315. Count of Smaller Numbers After Self You are given an integer array nums and you have to return a new counts array. The counts array has the property where counts[i] is the number of smaller elements to the right of nums[i]. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 Example 1: Input: nums = [5,2,6,1] Output: [2,1,1,0] Explanation: To the right of 5 there are 2 smaller elements (2 and 1)....

<span title='2021-09-08 00:00:00 +0000 UTC'>September 8, 2021</span>&nbsp;·&nbsp;2 min&nbsp;·&nbsp;volyx

307. Range Sum Query - Mutable

307. Range Sum Query - Mutable Given an integer array nums, handle multiple queries of the following types: Update the value of an element in nums. Calculate the sum of the elements of nums between indices left and right inclusive where left <= right. Implement the NumArray class: NumArray(int[] nums) Initializes the object with the integer array nums. void update(int index, int val) Updates the value of nums[index] to be val....

<span title='2021-09-03 00:00:00 +0000 UTC'>September 3, 2021</span>&nbsp;·&nbsp;3 min&nbsp;·&nbsp;volyx