Algorithm for Integer Arrays
\n\nfunction sumOfFlooredPairs(nums) {\n  const MOD = 1000000007;\n  const maxNum = Math.max(...nums);\n  const freq = new Array(maxNum + 1).fill(0);\n  for (le
\n```\nfunction sumOfFlooredPairs(nums) {\n  const MOD = 1000000007;\n  const maxNum = Math.max(...nums);\n  const freq = new Array(maxNum + 1).fill(0);\n  for (let num of nums) {\n    freq[num]++;\n  }\n  for (let i = 1; i <= maxNum; i++) {\n    freq[i] += freq[i - 1];\n  }\n  let res = 0;\n  for (let i = 1; i <= maxNum; i++) {\n    if (freq[i] - freq[i - 1] === 0) {\n      continue;\n    }\n    let sum = 0;\n    for (let j = 1; i * j <= maxNum; j++) {\n      let l = i * j - 1, r = Math.min(maxNum, i * j + i - 1);\n      sum += (freq[r] - freq[l]) * j;\n      sum %= MOD;\n    }\n    res += (sum * (freq[i] - freq[i - 1])) % MOD;\n    res %= MOD;\n  }\n  return res;\n}\n\n```\n\n> This is the most difficult thing I have solved
['JavaScript']