Two Sum - LeetCode 1 - Python Problem #1
Вставка
- Опубліковано 25 чер 2024
- Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
You may assume that each input would have exactly one solution, and you may not use the same element twice.
You can return the answer in any order.
We solve this problem using the brute force method (O(n^2)) and using hash map (O(n)).
Code: github.com/abhishekmshr956/Le...
LinkedIn: / abhishekmishraiitkgp
Twitter: / abhishek_iitkgp
0:00 Problem statement
1:47 O(n^2) brute force algorithm
4:36 O(n) hash map algorithm
10:00 brute force code
12:00 hash map code - Наука та технологія
please continue this series bro. Don't stop!. Btw great way of explanation.
nicely explained 👍