Serialize and Deserialize N-ary Tree
Serialize and deserialize an N-ary tree.
Input: root = [1]
Output: 1
Explanation: The tree only contains a root node, resulting in a minimal serialized string representation that can be accurately rebuilt.
Search for a Word in a 2D Board
Search for a word in a 2D board of characters.
Input: board = [["C","A","A"],["A","A","A"],["B","C","D"]], word = "AAB"
Output: TRUE
Explanation: DFS traverses adjacent matching letters perfectly, finding "AAB" without improperly revisiting any cells.
Add Two Numbers Represented as Strings
Add two non-negative integers represented as strings.
Input: num1 = "456", num2 = "77"
Output: "533"
Explanation: Performs character-by-character addition from right to left, carrying the 1 from 6+7=13 to the next decimal place.
Search a 2D matrix where each row and column is sorted.
Write an efficient algorithm that searches for a value target in an m x n integer matrix. Integers in each row are sorted, and the first integer of each row is greater than the last integer of the previous row.
Input: matrix = [[1,4],[2,5]], target = 20
Output: FALSE
Explanation:…
Validate if a given tree is a valid 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, and the right subtree contains only nodes with keys greater than the node's key…