原创 Unique Binary Search Trees

Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example, Given n =

原创 Restore IP Addresses

Given a string containing only digits, restore it by returning all possible valid IP address combinations. For exa

原创 Search for a Range

Given a sorted array of integers, find the starting and ending position of a given target value. Your algorithm's

原创 Palindrome Number

Determine whether an integer is a palindrome. Do this without extra space. click to show spoilers. Some hints: Could

原创 Next Permutation

Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of number

原创 Combination Sum

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

原创 Evaluate Reverse Polish Notation

Evaluate the value of an arithmetic expression in Reverse Polish Notation. Valid operators are +, -, *, /. Each o

原创 Binary Tree Level Order Traversal II

Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level b

原创 Sum Root to Leaf Numbers

Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example

原创 Letter Combinations of a Phone Number

Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit

原创 N-Queens II

Follow up for N-Queens problem. Now, instead outputting board configurations, return the total number of distinct

原创 Spiral Matrix II

Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order. For example, Give

原创 Word Search

Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequ

原创 Simplify Path

Given an absolute path for a file (Unix-style), simplify it. For example,path = "/home/", => "/home"path = "/a/./b

原创 原型鏈

前言 雖然接觸了很久的javascript,但是總感覺自己對js的prototype理解不到位。剛好今天在公司的所有活都做完了,就抽空把自己整理的筆記記錄下來(有很多是從網上的例子,自己動手操作加深理解)。 首先需要了解js的幾個概念