Category: data structure
Determine if a Sudoku is valid. The Sudoku board could be partially filled, where empty cells are filled with the character ‘.’. A valid Sudoku board (partially filled) is …
We have talked about the Pre-order in this post, and In-order Traversal for binary tree in this post. And this article talks about the third kind: Postorder traversal, which …
Return the preorder traversal of a binary tree’s nodes’ values. The pre-order displays the root/current node’s value first, then recursively calling into its left sub tree and right sub …
Remove the nth node from the end of a singly linked list and return its head. For example, input: 1-2-3-4-5, and n = 2. Removing the second node from …
Implement a basic calculator to evaluate a simple expression string. The expression string contains only non-negative integers, +, -, *, / operators and empty spaces . The integer division …