Given two numbers, add them without using addition operator.
Clock Angle Problem: Given time in hh:mm format, calculate the shorter angle between hour and minute hand in an analog clock.
In previous post, we have discussed C++ implementation of stack data structure using classes. In this article, we will make code generic for all data-types by using C++ templates.
Write code to efficiently evaluate given postfix expression.
Given an balanced expression that can contain opening and closing parenthesis, check if the expression contains any duplicate parenthesis or not.
Given an string containing opening and closing braces, check if it represents a balanced expression or not.
Given M sorted lists each containing N elements, print them in sorted order efficiently.
Given M sorted lists of variable length, efficiently compute the smallest range that includes at-least one element from each list.
In this post, we will see how to generate random numbers between 0 to n, both inclusive, in Java using Random class, Math.random(), ThreadLocalRandom class, SecureRandom class, and Apache Commons.
Given an array and positive integer k, find k’th smallest element in the array.
A stack is a linear data structure that serves as a container of objects that are inserted and removed according to the LIFO (last-in first-out) rule.
Given a k-sorted array that is almost sorted such that each of the N elements may be misplaced by no more than k positions from the correct sorted order. Find a space-and-time efficient algorithm to sort the array.