167. Two Sum II - Input Array Is Sorted | Python | MANG Question | Leetcode | English | code io

Опубликовано: 15 Май 2026
на канале: code io - English
403
17

167. Two Sum II - Input Array Is Sorted
https://leetcode.com/problems/two-sum...

In This video I have discussed a Naive approach to solve the problem and also have explained the Optimised approach and I have coded the solution in Python

GitHub link - Solution (Python, Java and C++)
https://github.com/c0de-i0/LeetCode-S...

Follow us on

Instagram
Goms -   / goms.io  
Siva -   / siva.io  

Linkedin
Goms -   / gomathinayagam-avudaikumar-509a7716a  
Siva -   / sivasubramanian-a-443519225  

167. Two Sum II - Input Array Is Sorted

Given a 1-indexed array of integers numbers that is already sorted in non-decreasing order, find two numbers such that they add up to a specific target number. Let these two numbers be numbers[index1] and numbers[index2] where 1 less = index1 less index2 less numbers.length.

Return the indices of the two numbers, index1 and index2, added by one as an integer array [index1, index2] of length 2.

The tests are generated such that there is exactly one solution. You may not use the same element twice.

Your solution must use only constant extra space.

Tags
#leetcode #interview #interviewpreparation #interviewprep #geeksforgeeks #amazoninterviewpreparation #amazoninterviewquestionsandanswers #mang #faang #fang #google #googleinterview #netflixinterview #hackerrank #leetcodesolutions #leetcodequestions #python #pythonprogramming