# Category Archives: Bit Magic

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
Given a binary string str, the task is to find the minimum operations required to convert the binary string in a non-decreasing manner such thatâ€¦ Read More
Given a binary array A[] and an integer X, the task is to check whether it is possible to divide A[] into exactly X non-emptyâ€¦ Read More
Given a positive integer n, write a function to find if it is a power of 2 or not Examples: Input: n = 4 Output:â€¦ Read More
Given two variables, x, and y, swap two variables without using a third variable. Method 1 (Using Arithmetic Operators): Example 1: The idea is toâ€¦ Read More
Given an array A[] of size N (0 â‰¤ A[i] â‰¤ 109). The following operations can be performed on the array. Choose a random integerâ€¦ Read More
Given a string S (‘a’ â‰¤ S[i] â‰¤ ‘t’) of length N (1 â‰¤ N â‰¤ 105), which consists of lowercase English alphabets, the taskâ€¦ Read More
Given a graph and the list of neighbours for each node in an array graph[] of size N, where graph[i] contains a list of neighborâ€¦ Read More
Given a string S of length N (1 â‰¤ N â‰¤ 103) that consists of a digit from ‘0’ to ‘9’, the task is toâ€¦ Read More
Given a binary string S of a number N, the task is to find a number X such that we can minimize the value ofâ€¦ 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
In a party of N people, each person is denoted by an integer. Couples are represented by the same number. Find out the only singleâ€¦ Read More
Given an array A[] consisting of N elements, the task is to find the minimum length of the subarray starting from each index and theâ€¦ Read More
Given two integers X and S, the task is to find the minimum length of the sequence of positive integers such that the sum ofâ€¦ Read More