## The Missing Semester of Your CS Education

When I was working as a teaching assistant last semester, I found that many students were not very familiar with some basic but efficient tools. So I was thinking that for students who have...

Skip to content
# Author: huadonghu

##
The Missing Semester of Your CS Education

##
Mount Rainier National Park

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

##
[LeetCode] 773. Sliding Puzzle

##
[LeetCode] 327. Count of Range Sum

##
Visit to Cancun

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

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

##
[LeetCode] 239. Sliding Window Maximum

##
[LeetCode] 968. Binary Tree Cameras

When I was working as a teaching assistant last semester, I found that many students were not very familiar with some basic but efficient tools. So I was thinking that for students who have...

Everyone will be amazed at Rainier‘s glaciated peak and her gorgeous scenes. I have been there for two times, but it definitely deserves more visits!

When coming into a tricky problem in coding interviews, you have no idea where to start with, and ugh, you mind just goes totally blank. The good news? It always happens to the best...

Solution Bidirectional BFS Set two queues, src queue and dest queue. Init src queue with input board, and dest queue with final state [[1,2,3],[4,5,0]]. When both queues are not empty, expand the queue with...

Solution A similar question is Leetcode 493, counting reverse pairs. A data structure “Binary Indexed Tree”, BIT, would help. Steps: Calculate prefix sum. -> sum[] Work out all lower bounds and upper bounds for...

I made a visit to Cancun before the spread of the Rona this Spring break. If you love tropical scene with blue sky, book a ticker to there right now!

Solution Official solutions have several approaches including sorting, heap, and quick selecting. They are all great. I’d like to put forward another solution: Binary Search. First, we can come to that the answer must...

Solution Use “Binary Indexed Tree (BIT)” (Fenwick Tree) data structure which supports querying prefix sum and adding a value to a single point. Binary Indexed Tree is a data structure not introduced on most...

Solution There are several approaches to solve this problem, like sliding window or DP. A more general description of this problem is how to quickly find a Maximum or Minimum between two indices in...

Solution This problem can be reduced to Minimum Dominating Set problem in Trees. Find minimum set of vertices such that every vertex is in or adjacent to set is NP-complete in general graphs, but...