Jobs
Interviews

Solve Two Sum Sorted Array using Lua Language

Solve Two Sum Sorted Array using Lua to enhance your skills with lua coding practice , master coding concepts, and prepare for interviews with practical exercises and detailed solutions.

Two Sum Sorted Array

Difficulty : Easy

Categories :

  • Arrays

Given an array of integers sorted in ascending order, find a pair of numbers that sum to a target value. Return the indices of these numbers. If multiple pairs exist, return the pair with the smallest left index.

Constraints:

  • 2 ≤ nums.length ≤ 10⁴
  • -10⁴ ≤ nums[i] ≤ 10⁴
  • nums is sorted in ascending order
  • The solution is guaranteed to exist

Examples:

Input:
nums = [1,2,3,4,5]
target = 7
Output: [1,4]
Explanation: nums[1] + nums[4] = 2 + 5 = 7
Input:
nums = [2,3,4]
target = 6
Output: [0,2]
Explanation: nums[0] + nums[2] = 2 + 4 = 6

Problem Solving

Input

What You'll Find Here

Real-World Applications Solve problems inspired by Lua's common use cases, such as game development and embedded systems.

Step-by-Step Guidance Break down Lua's concepts into digestible lessons.

Practical Skills Build hands-on experience with Lua for real-world projects.

Choose from the following categories