RUVIDEO
Поделитесь видео 🙏

Two Pointers 1 - Medium - Two Sum 2-Input array is sorted - Java

Coding Interviews - Two Sum 2-Input array is sorted (LeetCode)
This interview question is commonly asked by companies like Adobe, Amazon, Google.
We will start with one pointer pointing to the beginning of the array and another pointing at the end. At every step, we will see if the numbers pointed by the two pointers add up to the target sum. If they do, we have found our pair; otherwise, we will do one of two things:

- If the sum of the two numbers pointed by the two pointers is greater than the target sum, this means that we need a pair with a smaller sum. So, to try more pairs, we decrement the end-pointer.
- If the sum of the two numbers pointed by the two pointers is smaller than the target sum, this means that we need a pair with a larger sum. So, to try more pairs, we increment the start-pointer.


Time Complexity -
The time complexity of the above algorithm will be O(N), where ‘N’ is the total number of elements in the given array.

Space Complexity -
The algorithm runs in constant space O(1).

Two pointer playlist
1. Two Sum 2-Input array is sorted - https://youtu.be/dNcK87v3z18
2. Remove Duplicates from Sorted Array - https://youtu.be/yXb4HgYLp2g
3. Squares of a Sorted Array - https://youtu.be/dRr9mLZyz_M
4. Dutch National Flag or Sort Colors - https://youtu.be/Ye48iT5YKpo
5. 3 Sum - https://youtu.be/6xg7ZGfhQdo
6. 3 Sum Smaller - https://youtu.be/VW0zTPMmv9Q
7. 4 Sum - https://youtu.be/co-St3w1mkw
8 . Shortest Unsorted Continuous Subarray - https://youtu.be/Cn4vPghVglU


Know more about me
LinkedIn - https://www.linkedin.com/in/umang-mavani/

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Two Pointers 1 - Medium - Two Sum 2-Input array is sorted - Java», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.