Tag: data structure
Design a class to find the kth largest element in a stream. Note that it is the kth largest element in the sorted order, not the kth distinct element. …
We have a list of points on the plane. Find the K closest points to the origin (0, 0). (Here, the distance between two points on a plane is …
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 …
Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others are …
Find the sum of all left leaves in a given binary tree. There are two left leaves in the binary tree, with values 9 and 15 respectively. Return 24. …