原创 leetcode-Permutations
Given a collection of numbers, return all possible permutations. For example,[1,2,3] have the following permutations:
原创 看了thinking in java 的initialize and cleanup 的一點總結
關於this: 1 Can only be used in the non-static method-produce the reference to the object the method has been called for.
原创 leetcode-valid binary search tree
Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The lef
原创 leetcode-3Sum總結
public class Solution { public List<List<Integer>> threeSum(int[] num) { ArrayList<List<Integer>> result=ne
原创 leetcode-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 is
原创 leetcode-letter combination of a phone number
Given a digit string, return all possible letter combinations that the number could represent. A mapping of digit to
原创 leetcode-generate parentheses
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example,
原创 leetcode-3 closest
<p style="box-sizing: border-box; margin-top: 0px; margin-bottom: 10px; color: rgb(51, 51, 51); font-family: 'Helvetica
原创 leetcode-palindrome number
public boolean isPalindrome(int x) { if(x<0)return false; int y=0; int z=x; while(z>0){
原创 leetcode-add binary
Given two binary strings, return their sum (also a binary string). For example, a = "11" b = "1" Return "100". public
原创 leetcode-4sum
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all un
原创 leetcode-trapping rain water
這是第一種方法:/*maintain two pointers, think of it has real live water.. fill the container from two sides how the water will
原创 leetcode-two sum
Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum s
原创 leetcode-climbing stairs
Climbing Stairs Total Accepted: 36520 Total Submissions: 107274My Submissions Question Solution You are cli
原创 leetcode-anagrams
Given an array of strings, return all groups of strings that are anagrams. Note: All inputs will be in lower-case. p