Blind 75 vs NeetCode 150:Leetcode 刷題順序怎麼選?
Leetcode 刷題順序選擇困難?詳細對比 Blind 75 和 NeetCode 150 的特色與適用對象。Get started 準備面試。
Blind 75 vs NeetCode 150:Leetcode 刷題順序怎麼選? Read More »
技術文章LeetCode 題解彙整,84 篇。每篇的結構固定:解題思路、演算法步驟、複雜度分析、邊界情況與常見錯誤、3 種解法比較。想依題型練習,可以看二元樹、動態規劃、滑動視窗等題型標籤。
Leetcode 刷題順序選擇困難?詳細對比 Blind 75 和 NeetCode 150 的特色與適用對象。Get started 準備面試。
Blind 75 vs NeetCode 150:Leetcode 刷題順序怎麼選? Read More »
技術文章如何在 AI 時代刷 LeetCode?2026 面試終極指南教你避開題海陷阱,專注高效準備。結合 AI 工具與傳統算法,成為面試真正贏家。現在開始。
如何在 AI 時代刷 LeetCode?2026 面試終極指南 Read More »
技術文章A trie (pronounced as “try”) or prefix tree is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. There are various applications of this data structure, such as autocomplete and spellchecker.
Implement the Trie class:
Trie() Initializes the trie object.
void insert(String word) Inserts the string word into the trie.
int countWordsEqualTo(String word) Returns the number of instances of the string word in the trie.
int countWordsStartingWith(String prefix) Returns the number of strings in the trie that have the string prefix as a prefix.
void erase(String word) Erases the string word from the trie.
Implement Trie II 解題教學:3 種解法完整比較|LeetCode 1804 Best Practice Read More »
Leetcode, 技術文章Design a data structure that supports adding new words and finding if a string matches any previously added string.
Implement the WordDictionary class:
WordDictionary() Initializes the object.
void addWord(word) Adds word to the data structure, it can be matched later.
bool search(word) Returns true if there is any string in the data structure that matches word or false otherwise. word may contain dots ‘.’ where dots can be matched with any letter.
Design Add and Search Words Data Structure 解題教學:3 種解法完整比較|LeetCode 211 Best Practice Read More »
Leetcode, 技術文章A trie (pronounced as “try”) or prefix tree is a tree data structure used to efficiently store and retrieve keys in a dataset of strings. There are various applications of this data structure, such as autocomplete and spellchecker.
Implement the Trie class:
Trie() Initializes the trie object.
void insert(String word) Inserts the string word into the trie.
boolean search(String word) Returns true if the string word is in the trie (i.e., was inserted before), and false otherwise.
boolean startsWith(String prefix) Returns true if there is a previously inserted string word that has the prefix prefix, and false otherwise.
Implement Trie 解題教學:3 種解法完整比較|LeetCode 208 Best Practice Read More »
技術文章, LeetcodeGiven a binary search tree (BST), find the lowest common ancestor (LCA) node of two given nodes in the BST.
According to the definition of LCA on Wikipedia: “The lowest common ancestor is defined between two nodes p and q as the lowest node in T that has both p and q as descendants (where we allow a node to be a descendant of itself).”
Lowest Common Ancestor of a Binary Search Tree 解題教學:3 種解法完整比較|LeetCode 235 Best Practice Read More »
Leetcode, 技術文章Given the root of a binary search tree, and an integer k, return the kth smallest value (1-indexed) of all the values of the nodes in the tree.
Kth Smallest Element in a BST 解題教學:3 種解法完整比較|LeetCode 230 Best Practice Read More »
Leetcode, 技術文章Given the root of a binary tree, determine if it is a valid binary search tree (BST).
A valid BST is defined as follows:
The left subtree of a node contains only nodes with keys less than the node’s key.
The right subtree of a node contains only nodes with keys greater than the node’s key.
Both the left and right subtrees must also be binary search trees.
Validate Binary Search Tree 解題教學:3 種解法完整比較|LeetCode 98 Best Practice Read More »
Leetcode, 技術文章Given two integer arrays preorder and inorder where preorder is the preorder traversal of a binary tree and inorder is the inorder traversal of the same tree, construct and return the binary tree.
Construct Binary Tree from Preorder 解題教學:3 種解法完整比較|LeetCode 105 Best Practice Read More »
Leetcode, 技術文章Given the roots of two binary trees root and subRoot, return true if there is a subtree of root with the same structure and node values of subRoot and false otherwise.
A subtree of a binary tree tree is a tree that consists of a node in tree and all of this node’s descendants. The tree tree could also be considered as a subtree of itself.
Subtree of Another Tree 解題教學:3 種解法完整比較|LeetCode 572 Best Practice Read More »
Leetcode, 技術文章