Become a member
Sign in
CodeMySky
CodeMySky

CodeMySky

1 Following
16 Followers
  • Profile
  • Claps

Latest

CodeMySky
CodeMySky
Apr 6 · 1 min read

Binary Search Tree Iterator

Ref: https://leetcode.com/problems/binary-search-tree-iterator/

First Thought

I decided to put the majority of the functions in hasNext() , if we want to iterate through the binary search tree, we need a in-order…

CodeMySky
CodeMySky
Apr 6 · 1 min read

3Sum Closest

Ref: https://leetcode.com/problems/3sum-closest/

First Thought

3Sum is a variation of 2Sum Closest, if we sort the array first, then iterate through all the numbers, chose 2Sum closest in the rest of the array, we can get all the combinations…

CodeMySky
CodeMySky
Apr 6 · 1 min read

Number of Distinct Islands

Ref: https://leetcode.com/problems/number-of-distinct-islands
Ref: https://lintcode.com/problem/number-of-distinct-islands

First Thought

CodeMySky
CodeMySky
Apr 1 · 1 min read

Coin Change 2

Ref: https://leetcode.com/problems/coin-change-2/

First Thought

The difference between Coin Change and this question is that the previous question wants a combination with least amount of coins while in this question we want all the combination…

CodeMySky
CodeMySky
Apr 1 · 1 min read

Permutation II

Ref: https://leetcode.com/problems/permutations-ii/

First Thought

Compared with Permutation, the key for Permutation II is that because we select one digit at a time, we want to skip all candidates same with the current one after we made…