Invert a binary tree so that the left and right children of each node swap.
A palindrome is a word, phrase, number, or other sequence of characters which reads the same backward or forward. Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.
Given the root and two nodes in a binary tree. Find the lowest common ancestor(LCA) of the two nodes.
Given a Sudoku board, write an algorithm to determine if the board is valid.
Given a binary search tree and a new tree node, insert the node into the tree. You should keep the tree still be a valid binary search tree.
Ugly number is a number that only have factors
5. Design an algorithm to find the nth ugly number. The first 10 ugly numbers are
1, 2, 3, 4, 5, 6, 8, 9, 10, 12, ...
Design an iterator over a binary search tree with the following rules:
Cosine similarity is a measure of similarity between two vectors of an inner product space that measures the cosine of the angle between them. The cosine of 0° is 1, and it is less than 1 for any other angle. It is defined as follows:
Given k strings, find the longest common prefix (LCP).
The code base version is an integer start from 1 to n. One day, someone committed a bad version in the code case, so it caused this version and the following versions are all failed in the unit tests. Find the first bad version.