PracHub
QuestionsPremiumLearningGuidesCheatsheetNEWCoaches
|Home/Coding & Algorithms/Snapchat

Find all quadruplets summing to target

Last updated: Mar 29, 2026

Quick Overview

This question evaluates competency in array algorithms, combinatorial search, and handling duplicates with index-uniqueness constraints, and falls under the Coding & Algorithms domain.

  • medium
  • Snapchat
  • Coding & Algorithms
  • Machine Learning Engineer

Find all quadruplets summing to target

Company: Snapchat

Role: Machine Learning Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

## Problem Given an integer array `nums` (length `n`) and an integer `target`, return **all unique quadruplets** `[a,b,c,d]` such that: - `a + b + c + d == target` - The quadruplet uses **four distinct indices** from `nums` - The output contains **no duplicate quadruplets** (order of quadruplets and order within a quadruplet do not matter) ## Input / Output - **Input:** `nums: int[]`, `target: int` - **Output:** `List<List<int>>` of unique quadruplets ## Constraints (typical interview) - `0 <= n <= 2000` - Values may be negative and may repeat ## Example - `nums = [1,0,-1,0,-2,2]`, `target = 0` - Output could be: `[[-2,-1,1,2],[-2,0,0,2],[-1,0,0,1]]` ## Clarifications - If no quadruplet exists, return an empty list. - Duplicates in `nums` are allowed, but duplicates in the returned quadruplets are not.

Quick Answer: This question evaluates competency in array algorithms, combinatorial search, and handling duplicates with index-uniqueness constraints, and falls under the Coding & Algorithms domain.

Related Interview Questions

  • Determine Whether Courses Can Be Completed - Snapchat (medium)
  • Solve Decimal Coin Change - Snapchat (medium)
  • Find Maximum Island Perimeter - Snapchat (medium)
  • Solve Three Algorithmic Tasks - Snapchat (hard)
  • Implement a Timestamped Counter - Snapchat (medium)
Snapchat logo
Snapchat
Feb 12, 2026, 12:00 AM
Machine Learning Engineer
Onsite
Coding & Algorithms
2
0
Loading...

Problem

Given an integer array nums (length n) and an integer target, return all unique quadruplets [a,b,c,d] such that:

  • a + b + c + d == target
  • The quadruplet uses four distinct indices from nums
  • The output contains no duplicate quadruplets (order of quadruplets and order within a quadruplet do not matter)

Input / Output

  • Input: nums: int[] , target: int
  • Output: List<List<int>> of unique quadruplets

Constraints (typical interview)

  • 0 <= n <= 2000
  • Values may be negative and may repeat

Example

  • nums = [1,0,-1,0,-2,2] , target = 0
  • Output could be: [[-2,-1,1,2],[-2,0,0,2],[-1,0,0,1]]

Clarifications

  • If no quadruplet exists, return an empty list.
  • Duplicates in nums are allowed, but duplicates in the returned quadruplets are not.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Snapchat•More Machine Learning Engineer•Snapchat Machine Learning Engineer•Snapchat Coding & Algorithms•Machine Learning Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.