原创 [Leetcode] Convert Sorted List to Binary Search Tree Solution

Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. Ideas:  F

原创 [LeetCode] Linked List Cycle II Solution

Given a linked list, return the node where the cycle begins, if there is no cycle, return null. Follow up: could you so

原创 [LeetCode] Reverse Linked List II Solution

Reverse a linked list from position m to n, Do it in-place and in one-pass. For example:  Given 1->2->3->4->5->NULL, m

原创 [LeetCode] Remove Duplicates from Sorted Array II

Follow up for "Remove Duplicates". What if duplicates are allowed at most twice? For example, Given sorted array A=[1,

原创 [LeetCode] 4Sum Solution

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 unique

原创 [LeetCode] Remove Duplicates from Sorted Array

Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.

原创 [LeetCode] 3Sum Solution

Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0?  Find all unique triplets in t

原创 [LeetCode] Linked List Cycle

Given a linked list, deter if it has cycle in it. Follow up: can you solve it without using extra space? Idea: use slo

原创 【LeetCode】Linked List 類題目列表

明確了目標: (2015年1月1日前完成 leetcode).  我們就要有計劃,有安排,最終實現我們的目標。 LeetCode:共154題 時間: 11.2 to 12. 31 共計 29 + 31 = 60 天 平均154/6

原创 [LeetCode] 計劃和安排 之二

2014-11-9 到 2014-11-15類別:【Two Pointers】https://oj.leetcode.com/tag/two-pointers/[2014-11-9][LeetCode] Valid Palindrome[

原创 [LeetCode Solution] Merge k sorted Lists

Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. Idea: 1. we know how

原创 [LeetCode] Two Sum

Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum sho

原创 Catalan Number (卡特蘭數)

1. 什麼是卡特蘭數(Catalan Number)? Catalan Number 是一組有規律的數列,由比利時叫什麼什麼卡特蘭的數學家的名字命名的。它是怎樣的一組數列呢? 1, 2, 5, 14, 132, 429。。。。。。 2.

原创 [LeetCode] 3Sum Closest

Given an array of S of n integers, find three integers in S such that the sum is closest to a given number, target. Ret

原创 [LeetCode] Valid Palindrome

Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. Note:Have