Tag: C++ algorithms
This is quite similar to the Two Sum puzzle. Given a collection of numbers, write a function that finds a pair that will sum to a given value. For …
Implement a function countNumbers that accepts a sorted vector of unique numbers (integers), and efficiently with respect to time used, counts the number of vector elements that are less …
Given a BST (Binary Search Tree) with duplicates, find its mode(s) – the most frequently occurred element. A BST has the following characteristics: The left subtree of a node …
Given a binary tree root, return whether it’s a binary search tree. A binary tree node is a binary search tree if : All nodes on its left subtree …