Validate a Binary Search Tree (BST). Write a method isValidBST that ensures every node to the left is smaller than the root, and every node to the right is larger.

"If we want $a \times b$ to be divisible by $n$, we don't need to iterate every pair. We can reason that for every pair $(a, b)$, their product must contain the prime factors of $n$. The mathematical optimization involves checking GCD values, but for the scope of a coding test, a slight optimization involves realizing that if we know $a$, we can determine constraints for $b$."

Common problems include Binary Search implementation (e.g., "Sorted Search") or working with HashSets (e.g., "Song" similarity).

| Edge Case | Example Input | Expected Behavior | |-----------|---------------|------------------| | Null input | null instead of array | Return 0 or empty, no crash | | Empty collection | [] or "" | Graceful fallback | | Duplicate values | [1,1,2] | Treat as set or count once? | | Very large input | 10^6 elements | O(n²) will time out | | Negative numbers | [-3, -1, -2] | Consecutive logic still works |

Uses ConcurrentHashMap for thread safety. Stores timestamp + TTL. Checks expiry on each get.

Ready to create a quiz? Use Canvas to test your knowledge with a custom quiz Get started