Why use left-shift and right-shift operators instead of generic divide(/) and multiply(*) operators? Explanation: The '/' and '*' operators can be very time-consuming...
Sometimes interviewers also twist the question and ask you to check if the nth bit is set or not. You have to follow the same approach. Algorithm and approach: Left shift 1...
The easy solution to this problem is to convert the given number into a binary string. Loop over all the characters in the string. A number of ones in the string are nothing but...
We all know about the odd and even numbers. In simple terms, if the number is divisible by two, it is even. If the number is not divisible by two, it is...
Problem Statement: You are given a string (says 's'), and an integer ( says 'k'). Write a program to find the lexicographically smallest and largest substring from given...
First of all, understand the Hourglass. It is shaped as shown in the below image. There can be multiple hourglasses in the 2D array (matrix). Problem Statement: Write...
Do you want to learn and develop your first Android App? Don't worry. Building a basic Android app is not as difficult as it was earlier. There are a lot of tools and...