原创 Design a valet parking system.

Design a valet parking system. Requirements of the valet parking system should be: 1. Customer are given a ticket that

原创 Remove Node in Binary Search Tree

This is one of the pretty interesting technical interview questions I see, it is rather fundamental, you probably have

原创 Lowest Common Ancestor (LCA) of two nodes in graph

In graph theory and computer science, the lowest common ancestor (LCA) of two nodes v and w in a tree or directed

原创 OOD - Arithmetic Expression Tree

package OO_Problems; public class ArithmeticExpressionTree { public interface AENode{ public double evaluate() thro

原创 這兩道題的區別 LeetCode Permutations 和 LeetCode Combinations

刷第一遍的時候覺得這兩道題巨尼瑪像,但是爲啥一個用了isVisited boolean數組,一個就是正常iterate。 刷第二遍的時候終於醒悟了: 1,Permutation - Order Matters!!!!! 要回溯,[1,4

原创 Two Sum Closest to K

An Array of integers is given, both +ve and -ve. You need to find the two elements such that their sum is closest to ta

原创 How to compare 2 arrays in java

<pre name="code" class="java">// we need to import java.util.Arrays to use Arrays.equals(). import java.util.Arrays; cl

原创 Maze problem 的OO Design - 寫給煜小堆

Question:  How do you design a Maze and what kind of data structures you use for Maze. In addition, w