Two Sum Variations

  1. Two Sum
  2. Two Sum II - Input Array Is Sorted
  3. Two Sum III - Data Structure Design
  4. Two Sum IV - Input is a BST
  5. Two Sum BSTs
  6. Two Sum Less Than K
  7. Two Sum - Less than or equal to target
  8. Three Sum
  9. Three Sum Closest
  10. Three Sum Smaller
  11. 3sum-smaller
  12. 3Sum (a variant where you need to find three numbers that add up to zero)
  13. 3Sum Closest (similar to the above, but you need to find the three numbers that their sum is closest to a target value)
  14. Four Sum
  15. Four Sum II
  16. 4 sum
  17. 4Sum II (four arrays are given and you need to find the count of all the quadruplets which gives the target sum)
  18. 4Sum (same as Two Sum, but with four elements instead of two)
  19. Boats to Save People
  20. Count Good Meals
  21. Count Nice Pairs in an Array
  22. Count Number of Bad Pairs
  23. Count Number of Pairs with Absolute Difference K
  24. Divide Players into Teams of Equal Skill
  25. Finding Pairs with a Certain Sum
  26. K-Diff Pairs in an Array
  27. Max Number of K-Sum Pairs
  28. Number of Excellent Pairs
  29. Number of Pairs of Strings With Concatenation Equal to Target
  30. Number of Subsequences That Satisfy the Given Sum Condition
  31. Tuple with Same Product
  32. Valid Triangle Number
  33. Max Dot Product of Two Subsequences (a variation in a sense because it’s about finding two subsequences rather than just two numbers)
  34. Smallest Range Covering Elements from K Lists (a variation in a sense because it’s about finding two numbers from different lists rather than within the same list)

These variations challenge you to apply the Two Sum problem-solving approach in different scenarios and with varying constraints, thus deepening your understanding and mastery of this basic building block. These all have the underlying idea of looking for two elements that satisfy a certain condition related to their sum, though the specifics may vary.