原创 LeetCode題解:Construct the Rectangle

For a web developer, it is very important to know how to design a web page's size. So, given a specific rectangular we

原创 LeetCode題解:3Sum

3Sum Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets

原创 LeetCode題解:Merge/Insert Interval

Merge Intervals Given a collection of intervals, merge all overlapping intervals. For example, Given [1,3],[2,6],[8,1

原创 LeetCode題解:Divide Two Integers

Divide Two Integers Divide two integers without using multiplication, division and mod operator. 思路: 核心思想是:令試除數等於除數,

原创 LeetCode題解: Valid Number

Valid Number Validate if a given string is numeric. Some examples:"0" => true" 0.1 " => true"abc" => false"1 a" => fa

原创 LeetCode題解:LRU Cache

LRU Cache Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following

原创 LeetCode題解:Implement strStr()

Implement strStr() Implement strStr(). Returns a pointer to the first occurrence of needle in haystack, or null if ne

原创 LeetCode題解:Evaluate Reverse Polish Notation

Evaluate Reverse Polish Notation Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid op

原创 LeetCode題解:Search in Rotated Sorted Array

Search in Rotated Sorted Array Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1

原创 LeetCode題解:Sqrt(x)

Sqrt(x) Implement int sqrt(int x). Compute and return the square root of x. 思路: 可以考慮二分搜索,但是二分搜索的起點不好判定,不過可以預先計算好nume

原创 LeetCode題解:Combination Sum I and II

Combination Sum Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where

原创 Amazon DynamoDB的模型

Amazon的DynamoDB是一個NoSQL類型的數據庫。 數據庫(Database)是由表(Table)組成的。每個表則由項(Item)組成。每一項包含任意個屬性(Attribute),但是總共大小不能超過64KB。每個屬性都是一個

原创 LeetCode題解:Counting Bits

Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in t

原创 LeetCode題解:Teemo Attacking

In LLP world, there is a hero called Teemo and his attacking can make his enemy Ashe be in poisoned condition. Now, gi

原创 LeetCode題解:Battleships in a Board

Given an 2D board, count how many battleships are in it. The battleships are represented with 'X's, empty slots are r