Rotate a linked list to the right by k places.
Given the head of a linked list, rotate the list to the right by k places.
Input: head = [0,1,2], k = 4
Output: [2,0,1]
Explanation: The list has a length of 3. Rotating by 4 is mathematically equivalent to rotating by 1 (4 mod 3 = 1).
Connected Components in an Undirected Graph
Determine the number of connected components in an undirected graph.
Input: n = 4, edges = [[0,1],[2,3]]
Output: 2
Explanation: The graph is split completely evenly into two distinct isolated components: nodes {0,1} and nodes {2,3}.
Implement a Trie
Implement a Trie for prefix matching.
Input: insert("hello"), startsWith("hel")
Output: TRUE
Explanation: Traverses the Trie nodes to confirm that the prefix "hel" actively exists within the inserted word "hello".
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…
Valid Word Abbreviation
Determine if a string matches a valid word abbreviation.
Input: word = "apple", abbr = "a2e"
Output: FALSE
Explanation: The abbreviation claims exactly 2 characters are skipped between 'a' and 'e', but "ppl" is actually 3 characters long.