Swap two bits at a given position in an integer
Given an integer, swap two bits at given positions in a binary representation of it.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven an integer, swap two bits at given positions in a binary representation of it.
Given an array, reverse every group of consecutive m elements in a given subarray of it.
Given an integer array, find all distinct combinations of a given length k. The program should print only distinct combinations.
Given an unsorted integer array, find all pairs with a given difference k in it without using any extra space.
Given a square matrix, rotate the matrix by 180 degrees in a clockwise direction. The transformation should be done in-place in quadratic time.
Quickselect is a selection algorithm to find the k’th smallest element in an unordered list. It is closely related to the Quicksort sorting algorithm. Like Quicksort, it is efficient traditionally and offers good average-case performance, but has a poor worst-case performance.
Given an unsorted integer array, print all distinct four elements tuple (quadruplets) in it, having a given sum.
4-sum problem: Given an unsorted integer array, check if it contains four elements tuple (quadruplets) having a given sum.
Given a graph, determine if it is bipartite using DFS. A bipartite graph (or bigraph) is a graph whose vertices can be divided into two disjoint sets U and V such that every edge connects a vertex in U to one in V.
Given three strings, return true if the third string is interleaving the first and second strings, i.e., it is formed from all characters of the first and second string, and the order of characters is preserved.
This post will discuss the XOR linked list, which is used to reduce memory requirements of doubly-linked lists using a bitwise XOR operator.
Convert a given binary tree into a BST (Binary Search Tree) by keeping its original structure intact.