FastPrepTwo Sum with an Ordered Index Pair
Problems/Two Sum with an Ordered Index Pair

Two Sum with an Ordered Index Pair

Atlassian logoAtlassian● EasyFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The reported Two Sum capability matches at about 55%. The variant rule was not recalled. This practice uses the conventional distinct-index sum objective, chooses the smallest ordered index pair when several exist, and defines an empty result when none exists. Numeric bounds and every example are practice assumptions.

Given an integer array nums and an integer target, return two distinct indices [i,j] with i < j such that nums[i] + nums[j] == target.

If several pairs work, return the one with the smallest first index. If those first indices are equal, pick the smallest second index. Return an empty array when no pair works, including when nums has fewer than two numbers.

Repeated values may be used if they sit at different indices. Do not reorder or modify the input array.

Function

twoSumPair(nums: int[], target: int) → int[]

Examples

Example 1

nums = [2,7,11,15]target = 9return = [0,1]

Indices 0 and 1 contain 2 and 7, whose sum is 9.

Example 2

nums = [3,3,3]target = 6return = [0,1]

Any two of the three equal values add up to the target, so all three pairs work. [0,1] wins because both of its indices are the smallest.

Example 3

nums = [1,4,6,9]target = 10return = [0,3]

Both [0,3] and [1,2] sum to 10. Choose [0,3] because its first index is smaller.

Constraints

  • 0 <= nums.length <= 500.
  • -10^9 <= nums[i] <= 10^9.
  • -2 * 10^9 <= target <= 2 * 10^9.

More Atlassian Phone Screen questions

  • Merge Overlapping IntervalsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Tennis Court SchedulingPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Implement a Rate LimiterPHONE SCREEN · Seen Oct 2026
  • Longest Consistent Activity StreakPHONE SCREEN · Seen Sep 2026
  • Music Player Operation SequencePHONE SCREEN · Seen Sep 2026
  • Underline Shortest Unique SubstringsPHONE SCREEN · Seen Aug 2026
  • Can a Dictionary Word Be Formed from Note Letters?PHONE SCREEN · Seen Feb 2026
  • Word Path Moving Only Right or DownPHONE SCREEN · Seen Feb 2026
  • Ordered Badge Entry and Exit ViolationsPHONE SCREEN · Seen Aug 2025
  • Can You Finish the Teleporter Board?PHONE SCREEN · Seen Jul 2025

Similar questions at other companies

  • Merchant Payout Reserve CalculatorStripe · PHONE SCREENStripe interview questions
  • Price CheckBlue Origin · PHONE SCREEN
  • Majority ElementByteDance · PHONE SCREENByteDance interview questions
  • Detect a Straight FlushTemu · PHONE SCREENTemu interview questions
  • Recommend Films from Viewers Who Watched Everything You DidBloomberg LP · PHONE SCREENBloomberg LP interview questions
  • Find Unique ElementsCisco · PHONE SCREENCisco interview questions
  • Shared Courses for Every Pair of StudentsCrunchyroll · PHONE SCREENCrunchyroll interview questions
  • Two SumAmazon · OA · PHONE SCREEN
  • Employee Count Median, Mean and ModeClay · PHONE SCREEN
  • Two SumBNSF Railway · PHONE SCREENBNSF Railway interview questions

Atlassian interview experiences

  • Atlassian MLE Phone Screen: Model Deployment Design: 1 Experience
  • Atlassian Coding Screens and Karat: 3 Experiences (Part 2 of 2)
  • Atlassian Full Stack Interviews: 11 Experiences (Part 1 of 2)
All Atlassian interview questionsSee Atlassian hiring insights
Saved
class Solution {
    public int[] twoSumPair(int[] nums, int target) {
        // Write your code here.
        return new int[0];
    }
}
Checking account…