Same Tree Given the roots of two binary trees p and q, write a function to check...
Tree 資料結構解析 Tree Tree(樹) 是一種非線性階層式排列資料結構,因為具有樹狀結構,看起來像一個倒過來生長的樹。 樹狀結構的基本資料存儲單位是節...
Merge k Sorted Lists You are given an array of k linked-lists lists, each linked...
Reorder List You are given the head of a singly linked-list. The list can be rep...
Remove Nth Node From End of List Given the head of a linked list, remove the nth...
Linked List Cycle Given head, the head of a linked list, determine if the linked...
Reverse Linked List Given the head of a singly linked list, reverse the list, an...
Merge Two Sorted Lists You are given the heads of two sorted linked lists list1 ...
LinkedList - 資料結構簡介 LinkedList(鏈結串列) 是一種線性資料集合結構,但其資料集合順序卻不一定按線性的順序儲存資料。 LinkedL...
Find Minimum in Rotated Sorted Array Suppose an array of length n sorted in asce...
Search in Rotated Sorted Array There is an integer array nums sorted in ascendin...
Binary Search(二分搜尋法) Binary Search 是一種使用在有序陣列的搜尋演算法。 當給定的資料陣列是有排序過的,就可以透過 Binary...
Valid Parentheses Given a string s containing just the characters '(', ')', '{',...
Stack(堆疊) Stack 是種處理資料流的資料結構。 當資料流處理時,具備後進先出這樣的順序時。就可以使用 Stack。 著名題目河內塔(Hanoi To...
Minimum Window Substring Given two strings s and t of lengths m and n respective...
Longest Repeating Character Replacement You are given a string s and an integer...
Longest Substring Without Repeating Characters Given a string s, find the length...
Best Time to Buy and Sell Stock You are given an array prices where prices[i] is...
Sliding-Window 策略講解 Sliding Window 是一種演算法策略,通常用在字串或是陣列資料中。 透過把資料限縮在一定資料範圍之內來達成題目...
Container With Most Water You are given an integer array height of length n. The...
3Sum Given an integer array nums, return all the triplets [nums[i], nums[j], num...
Valid Palindrome A phrase is a palindrome if, after converting all uppercase let...
Two Pointers 策略 Two Pointer 是一種用來解決問題的演算法策略。 如同其字面上所指,會同時使用兩個指標來對搜尋範圍做限縮。 通常適合用在...
Longest Consecutive Sequence Given an unsorted array of integers nums, return th...
Encode and Decode Strings Design an algorithm to encode a list of strings to a s...
Product of Array Except Self Problem Description Given an integer array nums, re...
Group Anagrams Problem Description Given an array of strings strs, group the ana...
Top K Frequent Elements Problem Description Given an integer array nums and an i...
Valid Anagram Given two strings s and t, return true if t is an anagram of s, an...
contain duplicate Problem Description Given an integer array nums, return true i...