Skip to content

JustinButler700/Find-Mode-in-Binary-Search-Tree-LEETCODE-EASY

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

Find-Mode-in-Binary-Search-Tree-LEETCODE-EASY

Returns the mode of a binary search tree using a hashmap in java

Instructions: Given the root of a binary search tree (BST) with duplicates, return all the mode(s) (i.e., the most frequently occurred element) in it.

If the tree has more than one mode, return them in any order.

Assume a BST is defined as follows:

The left subtree of a node contains only nodes with keys less than or equal to the node's key. The right subtree of a node contains only nodes with keys greater than or equal to the node's key. Both the left and right subtrees must also be binary search trees.

Example 1:

Input: root = [1,null,2,2] Output: [2] Example 2:

Input: root = [0] Output: [0]

Constraints:

The number of nodes in the tree is in the range [1, 104]. -105 <= Node.val <= 105

Link to question: https://leetcode.com/problems/find-mode-in-binary-search-tree/

Releases

No releases published

Packages

No packages published

Languages