# Tag Archives: BIT

## Queries to find Kth greatest character in a range [L, R] from a string with updates

Given a string str of length N, and Q queries of the following two types: (1 L R K): Find the Kth greatest character (non-distinct)… Read More »

## Sum of previous numbers that are greater than current number for given array

Given an array A[], for each element in the array, the task is to find the sum of all the previous elements which are strictly… Read More »

## Queries to find the Lower Bound of K from Prefix Sum Array with updates using Fenwick Tree

Given an array A[ ] consisting of non-negative integers and matrix Q[ ][ ] consisting of queries of the following two types: (1, l, val):… Read More »

## Queries for count of array elements with values in given range with updates

Given an array arr[] of size N and a matrix Q consisting of queries of the following two types: 1 L R : Print the… Read More »

## Queries to search an element in an array and move it to front after every query

Given an integer M which represents an array initially having numbers 1 to M. Also given is a Query array. For every query, search the… Read More »

## Perform append, update, delete and range sum queries on the given array

Given an array arr[] of size N and the task is to answer Q queries of the following types: 1 X 0: Append X at… Read More »

## Longest Increasing Subsequence using BIT

Given an array arr, the task is to find the length of Longest Increasing Sequence using Binary Indexed Tree (BIT) Examples: Input: arr = {6,… Read More »

## Diameter of a Binary Indexed Tree with N nodes

Given a Binary Indexed Tree with N nodes except root node 0 (Numbered from 1 to N), Find its diameter. Binary Indexed Tree is a… Read More »

## Index of kth set bit in a binary array with update queries

Given a binary array arr[] and q queries of following types: k: find the index of the kth set bit i.e. kth 1 in the… Read More »

## All pairs whose xor gives unique prime

Given an array arr[], the task is to count all the pairs whose xor gives the unique prime, i.e. no two pairs should give the… Read More »

## Sum of decimal equivalent of all possible pairs of Binary representation of a Number

Given a number N. The task is to find the sum of the decimal equivalent of all the pairs formed from the binary representation of… Read More »

## Calculate the total fine to be collected

Given a date and an array of integer containing the numbers of the cars traveling on that date(an integer), the task is to calculate the… Read More »

## Add two unsigned numbers using bits

Given two unsigned integers (maximum possible input can be of 32 bits). The task is to add two numbers using bit operations. Examples: Input: n1… Read More »

## Queries for number of array elements in a range with Kth Bit Set

Given an array of N positive (32-bit)integers, the task is to answer Q queries of the following form: Query(L, R, K): Print the number of… Read More »

## Same Number Of Set Bits As N

Given a positive integer N, find out how many positive integers strictly less than N have the same number of set bits as N. Examples… Read More »