原创 【Leetcode】Combination sum 1,2
【題目】 【分析】 首先,先sort, 如果target > 0: 【代碼】 using recursive 這恐怕的 O(n2)... 過程: before recursion : [2] before recursion : [
原创 【Leetcode】Lowest common treenode in binary tree
【題目】 Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the defi
原创 【Leetcode】Search for a range
【題目】 Given a sorted array of integers, find the starting and ending position of a given target value. Your algorith
原创 【Leetcode】Largest Number
【題目】 Given a list of non negative integers, arrange them such that they form the largest number. For example, given [
原创 【Leetcode】Gas Station
【題目】 There are N gas stations along a circular route, where the amount of gas at station i is gas[i]. You have a car
原创 【Eclipse】Eclipse快捷鍵總結
Eclipse中10個最有用的快捷鍵組合 一個Eclipse骨灰級開發者總結了他認爲最有用但又不太爲人所知的快捷鍵組合。通過這些組合可以更加容易的瀏覽源代碼,使得整體的開發效率和質量得到提升。 1. ctrl
原创 【leetcode】Count Primes
【題目】 Description: Count the number of prime numbers less than a non-negative number, n. Credits: Special thanks to
原创 【Leetcode】Sort List in O(nlogn) O(1)space
【題目】 【思路】 First of all, allow me to explain the meaning of strict O(1) auxiliary space complexity. It means the max
原创 【Leetcode】Lowest Common Ancestor of a Binary Search Tree
【題目】 Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST. Accordin
原创 【Leetcode】Delete Node in a LinkedList
【題目】 Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Su
原创 【Leetcode】Panlidrome Linked List
【題目】 Given a singly linked list, determine if it is a palindrome. Follow up: Could you do it in O(n) time and O(1) spa
原创 【Leetcode】Rotate List
【題目】 Given a list, rotate the list to the right by k places, where k is non-negative. For example: Given 1->2->3->4->5
原创 【Leetcode】Merge K Sorted Linked List
【題目】 Merge k sorted Linked Lists and return it as one sorted lists. Analyze and describe its complexity . 【思路】 leetcode
原创 【Leetcode】Implement Queue using Stacks
【題目】 Implement the following operations of a queue using stacks. push(x) -- Push element x to the back of queue.pop()
原创 【Leetcode】Path sum 2
【題目】 Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum. For examp