原创 Leetcode 24. Swap Nodes in Pairs 分治
題目: Given a linked list, swap every two adjacent nodes and return its head. For example, Given 1->2->3->4, you shoul
原创 455. Assign Cookies
題目 Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at m
原创 392. Is Subsequence
題目 Given a string s and a string t, check if s is subsequence of t. You may assume that there is only lower case En
原创 leetcode 303. Range Sum Query - Immutable 【easy】
題目: Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: G
原创 算法概論 8.22
a,對圖G每個節點用DFS加上分支記錄方法,如果發現有邊指向分支已經到達過的點,則將該邊刪除。最後就能得到一個DAG,刪除的邊的集合則爲E`。每個節點要運算的複雜度爲O(n),對所有的n個節點進行操作,可知這個算法是O(n^
原创 LeetCode 23. Merge k Sorted Lists 【hard】
原題目: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 題解: 1分治 L
原创 3. Longest Substring Without Repeating Characters
原題: Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcb
原创 Leetcode 310. Minimum Height Trees【medium】
題目: For a undirected graph with tree characteristics, we can choose any node as the root. The result graph is then a r
原创 LeetCode 312. Burst Balloons 【hard】
原題: Given n balloons, indexed from 0 to n-1. Each balloon is painted with a number on it represented by array nums.
原创 LeetCode 332. Reconstruct Itinerary【medium】
原題: Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct t
原创 leetcode 413. Arithmetic Slices [medium]
題目: A sequence of number is called arithmetic if it consists of at least three elements and if the difference between
原创 LeetCode 169. Majority Element
原題: Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊
原创 2. Add Two Numbers解題思路
原題: You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and