Skip to content

Tag Archives: setBitCount

Two players, Player 1 and Player 2, are given an integer N to play a game. The rules of the game are as follows : … Read More
Bit stands for binary digit. A bit is the basic unit of information and can only have one of two possible values that is 0… Read More
Given an array arr[] of length N. You can perform at most K operations on the array of the following type:  Choose an index i… Read More
Given an array Arr[] of N integers and an integer K, the task is to find if it is possible to make the count of… Read More
Given two integers N and M denoting the size of an array and the sum of the elements of the array, the task is to… Read More
Given a positive integer N, the task is to find the minimum number of subtractions of power of 2 required to convert N to 0.… Read More
For two integers X and Y are the tasks is to find the number of bits that are the same in their binary representation by… Read More
Given a binary tree having N nodes, the task is to find the level having the maximum number of setbits. Note: If two levels have… Read More
Given an array arr (1-based indexing) of length N and an integer X, the task is to find and print all index ranges having a… Read More
Given two positive integers A and B, perform one of the following operations only once to make the numbers equal.  Change the ith bit of… Read More
Given a binary string str of length N, the task is to find the number of setbits in the bitwise OR of all the K… Read More
Given a number N and an integer K, the task is to set the Kth bit of the number N, i.e., if the Kth bit… Read More
Given a binary matrix arr[][] having N rows and M columns, the task is to calculate the minimum number of operations required to set the… Read More
Given a binary array arr[]. The task is to find the position of any 0 in arr[] such that the distance between two set bits… Read More
Given an array arr[] of N integers, the task is to replace each element of Array with their rank according to Rightmost-Set Bit (RSB) in… Read More