Remove all occurrences of `AB` and `C` from a string
Given a string, in-place remove all occurrences of AB and C from it. For example, for the input string is ‘CBAABCAB’, the string after removal of ‘AB’ and ‘C’ is ‘BA’.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven a string, in-place remove all occurrences of AB and C from it. For example, for the input string is ‘CBAABCAB’, the string after removal of ‘AB’ and ‘C’ is ‘BA’.
Find all interleavings of given strings that can be formed from all the characters of the first and second string where the order of characters is preserved.
Given two strings, determine if they are anagrams or not. Two strings X and Y are anagrams if by rearranging the letters of X, we can get Y using all the original letters of X exactly once.
Check if a given string can be derived from another string by circularly rotating it. The rotation can be in a clockwise or anti-clockwise rotation.
Given an integer, count its set bits using the Brian Kernighan’s algorithm.
Given a number, check if adjacent bits are set in the binary representation of it.
Find the total number of bits needed to be flipped to convert a given integer to another.
Check if the binary representation of a number is palindrome or not.
Given an integer, compute its absolute value (abs) without branching.
This post will discuss some bit hacks/tricks on letters of the English alphabet. 1. Convert uppercase character to lowercase, 2. Convert lowercase character to uppercase, 3. Invert alphabet’s case, 4. Find a letter’s position in alphabet.
This post will discuss a few related problems related to unsetting the rightmost set bit of a number.
This post will discuss a few related problems that operate on the k’th bit of a number. 1. Turn off k’th bit in a number, 2. Turn on k’th bit in a number, 3. Check if k’th bit is set for a number, 4. Toggle the k’th bit.