# Solution: Find Two Numbers That Add Up to k

Let’s solve the Find Two Numbers That Add Up to k problem.

We'll cover the following

## Statement

Given a list of integers, nums, and an integer target, k, find two numbers in the list that sum up to the target k.

There is exactly one solution for each input, and each element of the list can only be used once in the solution. The order of the returned elements does not matter.

Constraints:

• $2 \leq$ nums.length $\leq10^3$

• $-10^5\leq$ nums[i] $\leq 10^5$

• $-10^5\leq$ k $\leq10^5$

## Solution 1: Naive approach

The naive approach involves iterating through the entire list and, for each element, checking if there’s another element that, when added to it, equals the specified target, k. This is achieved by using a nested loop, where each loop iterates over the entire list. Essentially, it compares each element with every other element in the list to find a pair that sums up to the target k.

Let’s look at the code for this solution below:

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.