## Mount Rainier National Park

Everyone will be amazed at Rainier‘s glaciated peak and her gorgeous scenes. I have been there for two times, but…

## Guess what algorithm to use from input range when solving Leetcode problems or having coding interviews.

When coming into a tricky problem in coding interviews, you have no idea where to start with, and ugh, you…

## [LeetCode] 773. Sliding Puzzle

Solution Bidirectional BFS Set two queues, src queue and dest queue. Init src queue with input board, and dest queue…

## [LeetCode] 327. Count of Range Sum

Solution A similar question is Leetcode 493, counting reverse pairs. A data structure “Binary Indexed Tree”, BIT, would help. Steps:…

## Visit to Cancun

I made a visit to Cancun before the spread of the Rona this Spring break. If you love tropical scene…

## [LeetCode] 215. Kth Largest Element in an Array

Solution Official solutions have several approaches including sorting, heap, and quick selecting. They are all great. I’d like to put…

## [LeetCode]307. Range Sum Query – Mutable

Solution Use “Binary Indexed Tree (BIT)” (Fenwick Tree) data structure which supports querying prefix sum and adding a value to…

## [LeetCode] 239. Sliding Window Maximum

Solution There are several approaches to solve this problem, like sliding window or DP. A more general description of this…

## [LeetCode] 968. Binary Tree Cameras

Solution This problem can be reduced to Minimum Dominating Set problem in Trees. Find minimum set of vertices such that…

## [LeetCode] 644. Maximum Average Subarray II

Solution Since the average must be> = the smallest element in the array, and <= the largest element in the…