Tag Archives: BIT (adsbygoogle = window.adsbygoogle || []).push({});

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 »

Counting inversions in all subarrays of given size

Given an array and an integer k, count all inversions in all subarrays of size k. Example: Input : a[] = {7, 3, 2, 4,… Read More »

Subarray Inversions

We have an array A of n integers that we’re planning on sorting. Specifically, we want to know how close the array is to sorted.… Read More »

Order statistic tree using fenwick tree (BIT)

Given an array of integers with limited range (0 to 1000000). We need to implement an Order statistic tree using fenwick tree. It should support… Read More »

Position of rightmost different bit

Given two numbers m and n. Find the position of rightmost different bit in binary representation of numbers. It is guaranteed that such a bit… Read More »

Queries on substring palindrome formation

Given a string S, and two type of queries. Type 1: 1 L x, Indicates update Lth index of string S by x character. Type… Read More »

Top 10 Algorithms and Data Structures for Competitive Programming

In this post “Important top 10 algorithms and data structures for competitive coding “. Topics : Graph algorithms Dynamic programming Searching and Sorting: Number theory… Read More »