## Swap two bits at given position in an integer

Given an integer, swap two bits at given positions in binary representation of it.

Coding made easy

Given an integer, swap two bits at given positions in binary representation of it.

Given an array representing a Min Heap, convert Min Heap into a Max Heap. The conversion should be done inplace and in linear time.

Given an array, reverse every group of consecutive m elements in given subarray of it.

Write an algorithm to generate numbers from 1 to 7 with equal probability using a specified function which produces random numbers between 1 to 5 with equal probability.

In this post, we will see how to implement ternary-like operator in C without using conditional expressions like ternary operator, ifâ€“else expression or switch-case statements.

Given an array of integers, find a subset in it that has maximum product of its elements.

We have already covered how to flatten a Stream using flatMap() and concat() methods in Java 8. In this post, we will flatten a Stream in Java 8 using Stream.forEach() method.

Given an unsorted array of integers, print all pairs with given difference k in it without using any extra space.

Given two integers, add their binary representation.

Given an unsorted array of integers, print all pairs with given difference k in it.

In this post, we will discuss the difference between Stream.of() and Arrays.stream() method in Java.

Given a square matrix, rotate the matrix by 180 degrees in clock-wise direction. The transformation should be done in-place in quadratic time.