Back to problems

Number Pairs That Match Target

Algorithm · Netflix · Easy

You are given an array of integers nums and a target integer target. Your task is to find all valid arithmetic expressions that use two different elements from the array and evaluate exactly to the target. The allowed operations are addition (+), subtraction (-), multiplication (*), and division (/). For each unordered pair of distinct indices (i, j) with i != j, you must test both orderings: first treating a = nums[i] and b = nums[j], then treating a = nums[j] and b =…

Checking your access…