All Posts
Leetcode 1498: Number of Subsequences That Satisfy the Given Sum Condition
You are given an array of integers nums and an integer target. Your task is to count how many non-empty subsequences of nums exist such that the sum of the minimum and maximum element in each subsequence is less than or equal to target. Return the result modulo 10^9 + 7.
Leetcode 1508: Range Sum of Sorted Subarray Sums
You are given an array of positive integers. Compute all possible subarray sums, sort them in non-decreasing order, and return the sum of elements from index left to right in the sorted array modulo 10^9 + 7.
Leetcode 1577: Number of Ways Where Square of Number Is Equal to Product of Two Numbers
Given two integer arrays, nums1 and nums2, return the total number of valid triplets that can be formed under two conditions:
Type 1: A triplet (i, j, k) is valid if nums1[i]^2 == nums2[j] * nums2[k] where 0 <= i < nums1.length and 0 <= j < k < nums2.length. Type 2: A triplet (i, j, k) is valid if nums2[i]^2 == nums1[j] * nums1[k] where 0 <= i < nums2.length and 0 <= j < k < nums1.length.