java
lru
leetcode
Leetcode
Just
want
to
push
myself
to
practice
coding
Readme
里面并没有列出所有的题目的解法,只列出一些比较经典的
#
Title
Solution
Basic
idea
(One
line)
n
sum
1
1.
HashMap
O(n)
and
O(n)
space.2.
Sort
with
two
points
O(nlogn)
and
O(1)
space.
167
1.
two
pointers
O(n)
2.
binary
search
O(log(n!))
170
Use
HashMap
to
store
numbers.
Maintain
a
list
with
distinct
elements.
653
1.
DFS
+
HashSet
Time:
O(n),
Space:
O(n).2.
Inorder
traversal
+
two
pointers
Time:
O(n),
Space:
O(n)
3.
BST
iterator
+
stack
Time:
O(n),