Miscellaneous

## Maximum length substring having all same characters after k changes

We have a string of length n, which consist only UPPER and LOWER CASE characters and we have a number k (always less than n… Read More »

## Exact Cover Problem and Algorithm X | Set 1

If you have ever tried to create a program for solving Sudoku, you might have come across the Exact Cover problem. In this article, we… Read More »

## Master Theorem For Subtract and Conquer Recurrences

Master theorem is used to determine the Big – O upper bound on functions which possess recurrence, i.e which can be broken into sub problems.… Read More »

## Li-Fi

When a person visits a place, the first thing he checks is that if there is an open Wi-Fi connection available so that he could… Read More »

## Why start + (end – start)/2 is preferrable method for calculating middle of an array over (start + end)/2 ?

I am very sure that everyone is able to find middle index of array once you know start index and end index of array, but… Read More »

## Find the largest number with n set and m unset bits

Given two non-negative numbers n and m. The problem is to find the largest number having n number of set bits and m number of… Read More »

## std::basic_string::at in C++

Returns a reference to the character at the specified location pos. The function automatically checks whether pos is the valid position of a character in… Read More »

## Check if binary representations of two numbers are anagram

Given two numbers you are required to check whether they are anagrams of each other or not in binary representation. Examples: Input : a =… Read More »

Given a doubly linked list. The problem is to remove all adjacent duplicate nodes from the list such that the final modified doubly linked list… Read More »

## Find k-th bit in a binary string created by repeated invert and append operations

You are given an initial string s starting with “0”. The string keeps duplicating as follows. Invert of it is appended to it. Examples: Input… Read More »

## Unset bits in the given range

Given a non-negative number n and two values l and r. The problem is to unset the bits in the range l to r in… Read More »

## Toggle bits in the given range

Given a non-negative number n and two values l and r. The problem is to toggle the bits in the range l to r in… Read More »

## Toggle the last m bits

Given a non-negative number n. The problem is to toggle the last m bits in the binary representation of n. A toggle operation flips a… Read More »

## Efficiently check whether n is a multiple of 4 or not

Given a number n. The problem is to efficiently check whether n is a multiple of 4 or not without using arithmetic operators. Examples: Input… Read More »

## Set the rightmost unset bit

Given a non-negative number n. The problem is to set the rightmost unset bit in the binary representation of n. If there are no unset… Read More »