## Rearrange array elements such that Bitwise AND of first N – 1 elements is equal to last element

Given an array arr[] of N positive integers, the task is to find an arrangement such that Bitwise AND of the first N – 1… Read More »

## Longest subsequence with a given AND value

Given an array arr[] and an integer M, the task is to find the longest subsequence with a given AND value M. If there is… Read More »

## Longest subsequence with a given AND value | O(N)

Given an array arr[], the task is to find the longest subsequence with a given AND value M. If there is no such sub-sequence then… Read More »

## Number of subsets with a given AND value

Given an array arr of length N and an integer X, the task is to find the number of subsets whose AND value is X.… Read More »

## Bitwise AND of the sum of prime numbers and the sum of composite numbers in an array

Given an array of positive numbers, the task is to find the bitwise AND of the sum of non-prime numbers and the sum of prime… Read More »

## Check whether bitwise AND of N numbers is Even or Odd

Given an array arr[] containing N numbers. The task is to check whether the bitwise-AND of the given N numbers is even or odd. Examples:… Read More »

## Generate an array having Bitwise AND of the previous and the next element

Given an array of integers arr[] of N elements, the task is to generate another array having (Bitwise) AND of previous and next elements with… Read More »

## Maximum Bitwise AND value of subsequence of length K

Given an array a of size N and an integer K. The task is to find the maximum bitwise and value of elements of any… Read More »

## Find smallest positive number Y such that Bitwise AND of X and Y is Zero

Given an integer X. The task is to find the smallest positive number Y(> 0) such that X AND Y is zero. Examples: Input :… Read More »

## Partition the array in K segments such that bitwise AND of individual segment sum is maximized

Given an array of size N and an integer K. The task is to partition the array in K segments such that bitwise AND of… Read More »

## Count pairs of elements such that number of set bits in their AND is B[i]

Given two arrays A[] and B[] of N elements each. The task is to find the number of index pairs (i, j) such that i… Read More »

## Queries for bitwise AND in the given matrix

Given an N * N matrix mat[][] consisting of non-negative integers and some queries consisting of top-left and bottom-right corner of the sub-matrix, the task… Read More »

## Queries for bitwise AND in the index range [L, R] of the given array

Given an array arr[] of N and Q queries consisting of a range [L, R]. the task is to find the bit-wise AND of all… Read More »

## Find letter’s position in Alphabet using Bit operation

Given a string of English alphabets. The task is, for every character in the string print its position in the English alphabets. Note: The characters… Read More »

## Bitwise AND of sub-array closest to K

Given an integer array arr[] of size N and an integer K, the task is to find the sub-array arr[i….j] where i ≤ j and… Read More »