Tap here to switch tabs
Problem
Submissions

Problem: 4Sum II

med
30 min
Try to solve the 4Sum II problem.

Statement

Given four integer arrays nums1, nums2, nums3, and nums4, each of length n, return the total number of tuples (i, j, k, l) such that 0≤0 \leq i, j, k, l <n< n and:

nums1[i] ++ nums2[j] ++ nums3[k] ++ nums4[l] =0= 0

Constraints:

  • n == nums1.length

  • n == nums2.length

  • n == nums3.length

  • n == nums4.length

  • 1≤1 \leq n ≤200\leq 200

  • −228≤-2^{28} \leq nums1[i], nums2[i], nums3[i], nums4[i] ≤228\leq 2^{28}

⋮
Tap here to switch tabs
Problem
Submissions

Problem: 4Sum II

med
30 min
Try to solve the 4Sum II problem.

Statement

Given four integer arrays nums1, nums2, nums3, and nums4, each of length n, return the total number of tuples (i, j, k, l) such that 0≤0 \leq i, j, k, l <n< n and:

nums1[i] ++ nums2[j] ++ nums3[k] ++ nums4[l] =0= 0

Constraints:

  • n == nums1.length

  • n == nums2.length

  • n == nums3.length

  • n == nums4.length

  • 1≤1 \leq n ≤200\leq 200

  • −228≤-2^{28} \leq nums1[i], nums2[i], nums3[i], nums4[i] ≤228\leq 2^{28}