March 2025

[Leetcode] 1804. Implement Trie II

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.

[Leetcode] 1804. Implement Trie II Read More »

Leetcode, Technical Article

[LeetCode] 0020. Valid Parentheses

Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.

An input string is valid if:

Open brackets must be closed by the same type of brackets.
Open brackets must be closed in the correct order.
Every close bracket has a corresponding open bracket of the same type.

[LeetCode] 0020. Valid Parentheses Read More »

Leetcode, Technical Article
When AI can write programs faster than you, how can engineers find their new position?

When AI can write programs faster than you, how can engineers find their new position?

Imagine this scenario: you sit in front of your computer and describe the function you have in mind. A few seconds later, artificial intelligence will generate a piece of executable code for you, or even the entire application will be born. Does it sound a bit magical?
This scenario is no longer a fantasy, but a reality that is happening now. In recent years, AI coding technology has risen rapidly, gradually transforming from a novel topic in technology news to an important tool for daily development work. From GitHub Copilot to DeepSeek R1, artificial intelligence has not only changed the way programming is done, but may also subvert the development direction of the entire software industry.
So to what extent has AI coding technology developed? Will it replace engineers' jobs? As people working in the technology industry, how should we face this wave of technological advancement? This article will gradually analyze in depth the origin, current status, practical applications, impact on the industry, future development, and how technology industry professionals should respond to AI coding.

When AI can write programs faster than you, how can engineers find their new position? Read More »

software engineer,

[Leetcode] 0211. Design Add and Search Words Data Structure

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.

[Leetcode] 0211. Design Add and Search Words Data Structure Read More »

Leetcode, Technical Article

[Leetcode] 0208. Implement Trie

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 (ie, 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.

[Leetcode] 0208. Implement Trie Read More »

Leetcode, Technical Article

[Leetcode] 0235. Lowest Common Ancestor of a Binary Search Tree

Given 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).”

[Leetcode] 0235. Lowest Common Ancestor of a Binary Search Tree Read More »

Leetcode, Technical Article

[Leetcode] 0098. Validate Binary Search Tree

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.

[Leetcode] 0098. Validate Binary Search Tree Read More »

Leetcode, Technical Article
en_USEnglish