This repository has been archived by the owner on Nov 3, 2024. It is now read-only.
Implement Two Sum Algorithm #354
Labels
Hacktoberfest-2024
This PR is submitted for Hacktoberfest 2024.
SkillShow
Welcome to SkillShow! Contribute by creating an issue before opening a pull request!
Implement a function to solve the "Two Sum" problem. Given an array of integers (nums) and an integer (target), the goal is to return the indices of two numbers from the array such that their sum equals the target.
You must assume that:
Each input will have exactly one solution.
The same element cannot be used twice.
The result can be returned in any order.
Example Input/Output:
Example 1:
Input: nums = [2, 7, 11, 15], target = 9
Output: [0, 1]
Explanation: Because nums[0] + nums[1] == 9, we return [0, 1].
The text was updated successfully, but these errors were encountered: