mirror of
https://github.com/TheAlgorithms/C.git
synced 2026-07-09 02:26:34 +00:00
[PR #1504] [CLOSED] feat: add LeetCode problem 167 #2110
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/TheAlgorithms/C/pull/1504
Author: @Vaibhav-Patidar
Created: 10/20/2025
Status: ❌ Closed
Base:
master← Head:solution/two-sum-ii📝 Commits (1)
a77ee41Add solution for Two Sum II📊 Changes
2 files changed (+28 additions, -0 deletions)
View changed files
➕
leetcode/src/.DS_Store(+0 -0)➕
leetcode/src/167.c(+28 -0)📄 Description
Description of Change
Implemented the Two Sum II solution using the two-pointer approach. The function takes a sorted array and returns the 1-based indices of the two numbers whose sum equals the given target. It uses a single pass with O(n) time complexity and O(1) extra space. The result array is dynamically allocated, with memory management handled by the caller.
Checklist
Notes: Added the solution for Leetcode problem no.167 Two-Sum-II
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.