原创 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
原创 Excel Sheet Column Title
Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 1 -> A 2
原创 Word Pattern
Given a pattern and a string str, find if str follows the same pattern. Examples: pattern = “abba”, str = “dog ca
原创 求兩個字符串最長公共子串的長度
function maxCharLen(s1,s2) { var res = 0; for(var i = 0; i < s1.length; i++) { if(s2.indexOf(s1.charA
原创 Isomorphic Strings
Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can
原创 Valid Palindrome
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For
原创 Relative Ranks
Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be
原创 Perfect Number
We define the Perfect Number is a positive integer that is equal to the sum of all its positive divisors except its
原创 merge sorted array
Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. //方法1 function merge(n
原创 Assign Cookies
Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at mo
原创 Best Time to Buy and Sell Stock
Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted
原创 Add Digits
Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: G
原创 Plus One
Given a non-negative integer represented as a non-empty array of digits, plus one to the integer. You may assume th
原创 K-diff Pairs in an Array
Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here
原创 Reverse String II
Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from t