Tag: algorithms
Given a stream of integers and a window size, calculate the moving average of all integers in the sliding window. Example: MovingAverage m = new MovingAverage(3); m.next(1) = 1 …
August 31, 2020
algorithms, Binary Tree, c / c++, C/C++, code, data structure, interviews, Java, programming languages, Python
A Binary Search Tree (BST) is a commonly used data structure that can be used to search for an item in O(LogN) time. A BST has the following characteristics: …
Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. Example: Input: “aab” Output: , ] …
Given all the nodes of an N-ary tree as an array Node tree where each node has a unique value. Find and return the root of the N-ary tree. …
Given an array of numbers arr. A sequence of numbers is called an arithmetic progression if the difference between any two consecutive elements is the same. Return true if …