As reported: Mastercard Software Engineer 2 interview (June 2026), Tech SME round: Two Sum, alongside implementing a stack, a streams question and Spring/Hibernate concepts.
This is LeetCode 1 — Two Sum. Our write-up: /two-sum.
LeetCode Problem 1. Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
Example:
Input: nums = [2,7,11,15], target = 9.
Output: [0,1].
Explanation: As nums[0] + nums[1] = 2 + 7 = 9, we return [0, 1].
Code runner format: two JSON lines: nums, then target. Implement twoSum(nums, target); the indices may be in any order.