1 of 45

Two Sum

צביקה ברגר

בס"ד

2 of 45

https://leetcode.com/problems/two-sum/

בס"ד

3 of 45

Brute force

בס"ד

4 of 45

בס"ד

target = 10

5 of 45

בס"ד

target = 10

6 of 45

בס"ד

target = 10

7 of 45

בס"ד

target = 10

8 of 45

בס"ד

target = 10

9 of 45

בס"ד

target = 10

10 of 45

בס"ד

target = 10

11 of 45

בס"ד

target = 10

12 of 45

בס"ד

target = 10

13 of 45

Two Sum – Naive (Brute Force)

בס"ד

14 of 45

Sort and Binary Search

בס"ד

15 of 45

בס"ד

sort

16 of 45

בס"ד

target = 10

Binary search

find= 9

17 of 45

בס"ד

target = 10

Binary search

find= 9

18 of 45

בס"ד

target = 10

Binary search

find= 9

19 of 45

בס"ד

target = 10

Binary search

find= 8

20 of 45

בס"ד

target = 10

Binary search

find= 8

21 of 45

בס"ד

target = 10

Binary search

find= 8

22 of 45

Two Sum – Sort and Binary Search

בס"ד

23 of 45

Sort and Walking Inward

בס"ד

24 of 45

בס"ד

sort

25 of 45

בס"ד

target = 10

Walking Inward

26 of 45

בס"ד

target = 10

Walking Inward

27 of 45

בס"ד

target = 8

Walking Inward

28 of 45

בס"ד

target = 8

Walking Inward

29 of 45

בס"ד

target = 8

Walking Inward

30 of 45

בס"ד

target = 8

Walking Inward

31 of 45

בס"ד

target = 8

Walking Inward

32 of 45

Two Sum – Sort and Walking Inward

בס"ד

33 of 45

Hashing

בס"ד

34 of 45

בס"ד

target = 10

35 of 45

בס"ד

target = 10

5

36 of 45

בס"ד

target = 10

5 7

37 of 45

בס"ד

target = 10

5 7 9

38 of 45

בס"ד

target = 10

5 7 9 2

39 of 45

Two Sum - Hashing

בס"ד

40 of 45

Three Sum

בס"ד

41 of 45

Three Sum

בס"ד

42 of 45

gfh

בס"ד

43 of 45

gfh

בס"ד

44 of 45

Three Sum

בס"ד

45 of 45

בס"ד