What are Arrays?
- Ordered collection of elements
- Each element has an index, starting from 0
["a","b","c"]
- key fora
is0
,b
is1
etc
What are Hashes?
- Unordered collection of key-value pairs
- Each value is retrieved from their corresponding keys
- Implemented with dictionaries or maps
{ name: "Alice" }
- key isname
and value is"Alice"
Related examples
- Read my solution to some LeetCode problems below
- Contains Duplicate
- Group Anagrams
- https://docs.google.com/document/d/1OiEYxC6jXoZMtXaA2dt_krmBJ3YsWWykUzuC_4D4DXg/edit?usp=sharing
Resources
Concepts explained here are following those from Neetcode’s roadmap
.