Solution to Spiral Matrix by LeetCode

10 Jun

Question: https://oj.leetcode.com/problems/spiral-matrix/ Question Name: Spiral Matrix

Solution to Jump Game by LeetCode

9 Jun

Question: https://oj.leetcode.com/problems/jump-game/ Question Name: Jump Game

Solution to Maximum Subarray by LeetCode

9 Jun

Question: https://oj.leetcode.com/problems/maximum-subarray/ Question Name: Maximum Subarray This problem is a classic one.

Solution to N-Queens II by LeetCode

9 Jun

Question: https://oj.leetcode.com/problems/n-queens-ii/ Question Name: N-Queens II Same method as that in N-Queens problem. But we could save some time and space by not recording the chessboard.

Solution to Anagrams by LeetCode

7 Jun

Question: https://oj.leetcode.com/problems/anagrams/ Question Name: Anagrams

Solution to Pow(x, n) by LeetCode

5 Jun

Question: https://oj.leetcode.com/problems/powx-n/ Question Name: Pow(x, n) The simplest solution is to use the build-in function “pow” or build-in operation “**” of Python.

A second simple solution is recursive.

Finally, a iterative solution works here.

Solution to N-Queens by LeetCode

4 Jun

Question: https://oj.leetcode.com/problems/n-queens/ Question Name: N-Queens

Solution to Rotate Image by LeetCode

24 May

Question: https://oj.leetcode.com/problems/rotate-image/ Question Name: Rotate Image A same question as this one from CTCI.

Solution to Jump Game II by LeetCode

23 May

Question: https://oj.leetcode.com/problems/jump-game-ii/ Question Name: Jump Game II A similar problem with Fib-Frog by codility. But this one is much simpler.

Solution to Multiply Strings by LeetCode

22 May

Question: https://oj.leetcode.com/problems/multiply-strings/ Question Name: Multiply Strings