FastPrepTarget Sum Across Two Sorted Arrays
Problems/Target Sum Across Two Sorted Arrays

Target Sum Across Two Sorted Arrays

Squarepoint Capital logoSquarepoint Capital● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a Squarepoint Capital phone screen. The report keeps two sorted vectors, one target, a question of whether one value from each adds up to it, empty inputs, and a talk about overflow. We chose the function signature and signed 64-bit arithmetic with limits. Our version is about 97% the same as the reported question.

You are given two integer arrays first and second, each sorted in nondecreasing order, and a signed 64-bit integer target.

Return true if you can choose exactly one value from first and exactly one value from second whose sum equals target. Otherwise, return false. An empty input array therefore always produces false. Compute every candidate sum in signed 64-bit arithmetic.

Function

hasCrossArrayTargetSum(first: int[], second: int[], target: long) → boolean

Examples

Example 1

first = [1,3,5]second = [2,4,8]target = 9return = true

The values 1 and 8 form the target.

Example 2

first = []second = [1,2,3]target = 4return = false

No pair exists when either array is empty.

Example 3

first = [2147483647]second = [2147483647]target = 4294967294return = true

The pair sum is computed in signed 64-bit arithmetic.

Constraints

  • 0 <= first.length, second.length <= 200000.
  • Both arrays are sorted in nondecreasing order.
  • Every array value is a signed 32-bit integer.
  • -2^32 <= target <= 2^32 - 2.

More Squarepoint Capital Phone Screen questions

  • Lazy Filter over a GeneratorPHONE SCREEN · Seen Nov 2026
  • Moving Average of a Data StreamPHONE SCREEN · Seen Nov 2026
  • Newton Square Root to a Guaranteed TolerancePHONE SCREEN · Seen Nov 2026
  • Probability of Consecutive HeadsPHONE SCREEN · Seen Nov 2026
  • Three Points in a Semicircle: Monte Carlo EstimatePHONE SCREEN · Seen Nov 2026
  • Combine Two Index SequencesPHONE SCREEN · Seen Aug 2026
  • Parse, Normalize, and Combine PolynomialsPHONE SCREEN · Seen Aug 2026
  • Sorted Insertion SnapshotsPHONE SCREEN · Seen Aug 2026
  • Strong and Weak Reference LifecyclePHONE SCREEN · Seen Aug 2026
  • Classify Heap Addresses from a Memory SnapshotPHONE SCREEN · Seen Nov 2025

Similar questions at other companies

  • Target Sum Across Two Sorted ArraysBloomberg LP · PHONE SCREEN · ONSITE INTERVIEWBloomberg LP interview questions
  • Find K Closest Elements in a Sorted ArrayNavi · PHONE SCREEN
  • K Closest Elements in a Sorted ArrayAmazon · PHONE SCREEN
  • Count Winning Dice Face PairsGoogle · PHONE SCREENGoogle interview questions
  • Count Centaur Friend RequestsMeta · PHONE SCREENMeta interview questions
  • Count Triples That Can Form a TriangleAdobe · PHONE SCREENAdobe interview questions
  • Find the Duplicate in a Read-Only ArrayNutanix · PHONE SCREENNutanix interview questions
  • Search a Row- and Column-Sorted MatrixByteDance · ONSITE INTERVIEWByteDance interview questions
  • 3Sum SmallerSalesforce · ONSITE INTERVIEWSalesforce interview questions
  • K Smallest Squares from a Sorted ArrayUber · ONSITE INTERVIEWUber interview questions

Squarepoint Capital interview experiences

  • Squarepoint Capital Data Products First Round: 1 Experience
  • Squarepoint Capital C++ and Python SWE Interviews: 7 Experiences
  • Squarepoint Campus SDE Interviews: 7 Experiences (Part 2 of 2)
  • Squarepoint Capital New Grad SDE OA: 5 Experiences (Part 1 of 2)
All Squarepoint Capital interview questionsSee Squarepoint Capital hiring insights
Saved
class Solution {
    public boolean hasCrossArrayTargetSum(int[] first, int[] second, long target) {
      // write your code here
    }
}
Checking account…