Skip to content

Nitin-Mohapatra/two-sum-pointer-approach

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Two Sum in Sorted Array using Two Pointers - C

Description

This program finds two numbers in a sorted array that add up to a given target using the two-pointer technique.

How It Works

  1. The user inputs the number of elements in the array.
  2. The user inputs the elements in ascending order.
  3. The user enters the target sum.
  4. The program uses two pointers, left and right, to efficiently find a pair that sums to the target.

Example Run

Enter the no of element in the array: 5

Enter the elements in ascending order: 1 2 3 4 6

Enter the target no: 7

Output: 3 + 4 = 7

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages