Category: data structure
Given an array of sorted integers, let’s arrange it to a highly balanced binary search tree (BST). The left nodes of a binary search tree are smaller than the …
Two strings are isomorphic if the characters in one string can be replaced to get another one. No two characters may map to the same character. A character can …
Given a string that contains characters of ASCII no more than 256, sort it in non-ascending order based on the frequency of the characters. For example, Input “tree” the …
Suppose if you are given an array of N integers, how could you find out the top K elements based on its frequencies? For example, Input: nums = , …
Given the root node of a binary search tree (BST) and a value. You need to find the node in the BST that the node’s value equals the given …