Skip to content

Latest commit

 

History

History
40 lines (28 loc) · 784 Bytes

06-find-two-numbers-add-up-to-n.md

File metadata and controls

40 lines (28 loc) · 784 Bytes

Problem statement

easy

Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.

You may assume that each input would have exactly one solution, and you may not use the same element twice.

You can return the answer in any order.

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

Output 1
[0,1]

Input 2
nums = [3,2,4]
target = 6

Output 2
[1,2]

Source link
LeetCode

Link to solution method
Two integers that add up to n

<style> h3 { margin-bottom: 0; } .d-tag { margin-top: 0; font-style: italic; } </style>