FastPrepUnique Target-Sum Pairs in a Sorted Doubly Linked List
Problems/Unique Target-Sum Pairs in a Sorted Doubly Linked List

Unique Target-Sum Pairs in a Sorted Doubly Linked List

Arista Networks logoArista Networks● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in an Arista Networks full-time phone screen. We kept the sorted-list task, the example, and the follow-up that skips duplicates. Here your code gets the list's values from head to tail. Our version is about 96% the same as the reported question.

A sorted array values lists the node values of a doubly linked list from head to tail. Return every distinct value pair whose sum equals target.

  • Use two different node positions for a pair.
  • Return each value pair only once, even when duplicate nodes allow it in several ways.
  • Within a pair, place the smaller value first. Order the result by the first value, then the second.

Function

findUniquePairs(values: int[], target: int) → int[][]

Examples

Example 1

values = [1,2,3,4,6,8]target = 10return = [[2,8],[4,6]]

Both distinct value pairs sum to 10.

Example 2

values = [1,1,2,2,3,3]target = 4return = [[1,3],[2,2]]

Repeated nodes do not create repeated value pairs.

Constraints

  • 0 <= values.length <= 10^5
  • -10^9 <= values[i] <= 10^9
  • values is sorted in nondecreasing order.
  • -10^9 <= target <= 10^9

More Arista Networks interview questions

  • First Missing Number in a Consecutive ArrayOA · PHONE SCREEN · Seen Oct 2026
  • Remove All Repeated Values from a Linked ListPHONE SCREEN · Seen Oct 2026
  • Trace Nested Object Destruction OrderPHONE SCREEN · Seen Oct 2026
  • Trace Pointer Rebinding and Pointee UpdatesPHONE SCREEN · Seen Oct 2026
  • Swap Adjacent NibblesPHONE SCREEN · Seen Aug 2026
  • Generic Stack Operation SequencePHONE SCREEN · Seen Aug 2026
  • API Bandwidth AllocationOA · Seen Sep 2026
  • LFU CacheOA · Seen Sep 2026
  • Maximum Server Processing TimeOA · Seen Aug 2026
  • Minimum Adjacent Merges to Form a PalindromeOA · Seen Aug 2026

Similar questions at other companies

  • Detect and Break a Linked-List CycleAmazon · ONSITE INTERVIEW
  • Merge Sorted Squares of Two ArraysWhatNot · PHONE SCREEN · ONSITE INTERVIEW
  • Run-Length Encoded Vector Dot ProductMeta · PHONE SCREEN · ONSITE INTERVIEW
  • Interval List IntersectionsGrammarly · PHONE SCREEN
  • Subarray Product Less Than KApple · PHONE SCREEN
  • Subarray Product Less Than KAngel One · PHONE SCREEN
  • Subarray Product Less Than KThe D.E. Shaw Group · PHONE SCREEN
  • Trapping Rain WaterGoldman Sachs · PHONE SCREEN
  • Sort Ones, Twos, and Threes In PlaceAgoda · PHONE SCREEN · ONSITE INTERVIEW
  • Candy Crush Grid Matching and GravityRoblox · PHONE SCREEN · ONSITE INTERVIEW
See Arista Networks hiring insights
Saved
class Solution {
    public int[][] findUniquePairs(int[] values, int target) {
        // Write your solution here.
    }
}
Checking account…