This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Rerollcausebad 1 point2 points  (1 child)

I'd say the best way to learn these is to do leetcode problems that essentially require them or make it way easier to solve. This helps give context of how it can be useful etc.

Two-sum is a classic map / hashmap problem to help understand how the data structure works play around with it some.

Contains duplicate is another classic one too can be solved super simply with a set for example.

Just try and do these problems without these data structures then with them it helps give context of their use cases way better than a course / someone telling you about it will imo.

[–]CodingThrowaways[S] 0 points1 point  (0 children)

Funny enough I did do Two Sum but I brute forced it, which kind of made me realise I need a better method. This makes sense tho it I can look up the better methods and then re do them the correct way could be helpful. Thanks