Trapping Rain Water | Algorithm Problem
In this article, we are going to solve the trapping water problem. This kind of problems are asked very frequently in interviews and online programming challenges. Problem Statement We need to find the maximum volume of water that can be stored in between buildings or bars as shown in the below image. Assume that width of each […]
Program to find nth digit of the series 3, 5, 6, 9, 10, 12, …
Bit Manipulation programming questions are integral part of any online coding challenges or programming rounds of 3-4 year exp Java/C/Python developer interviews. So, why are we talking about bit manipulation in this series problem? Lets look at the binary representation of all the numbers in this series. Decimal Digit Binary Representation 3 0011 5 0101 6 […]
Program to check if a given number is power of two or not?
In this post, we will discuss about one of the easiest and commonly asked Bit Manipulation Interview Question i.e. Write a program to check if a given number is power of two or not? This post is continuation of our previuos article Program To Find Number Of Set Bits In The Number. Both of the approach […]
Program to find number of set bits in the Binary number
In this post, we will discuss about one of the easiest and commonly asked Bit Manipulation Interview Question i.e. Find total number of set bits in the given number? There are many approach to solve this problem. Here, we will discuss about below two approaches: & and >> Approach (Naive Approach) Brian Kernighan's Approach 1) & and >> Approach […]
Program to find Unique Array Element
Programming and coding interview questions are an integral part of any Java, Python or C++ application developer interview. No matter on which language you have expertise, good problem solving skills shows how efficient you are in solving any problem. In this post, we will discuss one of the very commonly asked programming question. .!! Problem Statement: In […]
Program to Check Whether a Number is Prime or Not
Prime Number A prime number can be divided, without a remainder, only by itself and by 1. For example, 13 can be divided only by 13 and by 1, so it is a prime number. In other words, When the only two factors of a number are 1 and the number, then it is a Prime […]
N Queen Problem Using Recursive Backtracking
N Queen Problem is the problem of placing N chess queens on an NxN chessboard so that no two queens attack each other, for which solutions exist for all natural numbers n except n=2 and n=3. A solution requires that no two queens share the same row, column, or diagonal. It is more general form of inital Eight queens problem, where we need to […]