Skip to content

Practice Sum of Floored Pairs

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Hard#1862
LeetCode Problem

Sum of Floored Pairs

Problem Statement

Given an integer array nums, return the sum of floor(nums[i] / nums[j]) for all pairs of indices 0 <= i, j < nums.length in the array. Since the answer may be too large, return it modulo 10^9 + 7. The floor() function returns the integer part of the division.

Source: Sum of Floored Pairs on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
nums = [2,5,9]
Output
10

# Example 2

Input
nums = [7,7,7,7,7,7,7]
Output
49

Constraints

1 <= nums.length <= 10^5
1 <= nums[i] <= 10^5

Related LeetCode Problems

Practice more problems similar to Sum of Floored Pairs.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.