title-img


Decibinary Numbers

Let's talk about binary numbers. We have an n-digit binary number, b , and we denote the digit at index i (zero-indexed from right to left) to be bi. We can find the decimal value of using the following formula: For example, if binary number b = 10010, we compute its decimal value like so: Meanwhile, in our well-known decimal number system where each digit ranges from 0 to 9, the value of some decimal number, d, can be expanded in the same way: Now that we've discussed both systems, l

View Solution →

Balanced Brackets

A bracket is considered to be any one of the following characters: (, ), {, }, [, or ]. Two brackets are considered to be a matched pair if the an opening bracket (i.e., (, [, or {) occurs to the left of a closing bracket (i.e., ), ], or }) of the exact same type. There are three types of matched pairs of brackets: [], {}, and (). A matching pair of brackets is not balanced if the set of brackets it encloses are not matched. For example, {[(])} is not balanced because the contents in betwe

View Solution →

Queues: A Tale of Two Stacks

A queue is an abstract data type that maintains the order in which elements were added to it, allowing the oldest elements to be removed from the front and new elements to be added to the rear. This is called a First-In-First-Out (FIFO) data structure because the first element added to the queue (i.e., the one that has been waiting the longest) is always the first one to be removed. A basic queue has the following operations: Enqueue: add a new element to the end of the queue. Dequeue: re

View Solution →

Largest Rectangle

Skyline Real Estate Developers is planning to demolish a number of old, unoccupied buildings and construct a shopping mall in their place. Your task is to find the largest solid area in which the mall can be constructed. There are a number of buildings in a certain two-dimensional landscape. Each building has a height, given by h[ i ] where i [ 1, n ]. If you join k adjacent buildings, they will form a solid rectangle of area . For example, the heights array . A rectangle of height and l

View Solution →

Min Max Riddle

Given an integer array of size n, find the maximum of the minimum(s) of every window size in the array. The window size varies from 1 to n. For example, given arr = [6, 3 , 5 , 1, 12 ] consider window sizes of 1 through 5. Windows of size are . The maximum value of the minimum values of these windows is . Windows of size are and their minima are ( 3, 3, 1, 1 ). The maximum of these values is . Continue this process through window size to finally consider the entire array. All of the ans

View Solution →