Miscellaneous

Minimum bitwise operations to convert given a into b.

Given two positive integer a and b you have to change a to b by applying any of the three operations on binary form of… Read More »

Minimum flips required to maximize a number with k set bits

Given two numbers n and k, we need to find the minimum number of flips required to maximize given number by flipping its bits such… Read More »

Count unset bits of a number

Given a number n, count unset bits after MSB (Most Significant Bit). Examples : Input : 17 Output : 3 Binary of 17 is 10001… Read More »

Set all the bits in given range of a number

Given a non-negative number n and two values l and r. The problem is to set the bits in the range l to r in… Read More »

Head command in Linux with examples

It is the complementary of Tail command. The head command, as the name implies, print the top N number of data of the given input.… Read More »

Implementing Stack in C#

Stack is a linear data structure. It follows LIFO(Last In First Out) pattern for Input/output. Following three basic operations are performed in the stack: Push:… Read More »

Count total bits in a number

Given a positive number n, count total bit in it. Examples: Input : 13 Output : 4 Binary representation of 13 is 1001 Input :… Read More »

Find most significant set bit of a number

Given a number, find the most significant bit number which is set bit and which is in power of two Examples: Input : 10 Output… Read More »

Check whether all the bits are unset in the given range or not

Given a non-negative number n and two values l and r. The problem is to check whether all the bits are unset or not in… Read More »

GwynnieBee Interview Experience (Full Time)

Gwynnie Bee came for recruitment to our university campus. The first round was a 2 hour written test. 1 hour was for 30 MCQs which… Read More »

Toggle all bits after most significant bit

Given a number, toggle all bits of it after most significant bit including most significant bit. Examples: Input : 10 Output : 5 Binary representation… Read More »

Align Cars Using Minimum Cost

You are the owner of a car gallery, and the vehicles you’ve ordered for the fancy car show has arrived. You have N cars each… Read More »

Cat command in Linux with examples

Cat(concatenate ) command is very frequently used in linux.It reads data from file and give their content as output.It helps us to create,view,concatenate files.So let… Read More »

Check if two given circles touch or intersect each other

There are two circle A and B with their centers C1(x1, y1) and C2(x2, y2) and radius R1 and R2. Task is to check both… Read More »

Check if two unsorted arrays (with duplicates allowed) have same elements

Given two unsorted arrays, check whether both arrays have same set of elements or not. Examples: Input : A = {2, 5, 6, 8, 10,… Read More »