Check if a repeated subsequence is present in a string or not
Given a string, check if a repeated subsequence is present in it or not. The repeated subsequence should have a length of 2 or more.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedGiven a string, check if a repeated subsequence is present in it or not. The repeated subsequence should have a length of 2 or more.
Given an integer, swap consecutive b bits starting from the given positions in a binary representation of an integer. The bits to be swapped should not overlap with each other.
Given two integers, find their minimum and maximum without using branching.
Given an integer, count set bits in it using a lookup table.
In this post, we will see how to compute the parity of a number using a lookup table. The parity refers to the total number of 1’s in the binary number.
Given an M × N matrix, calculate the maximum sum submatrix of size k × k in it in O(M × N) time.
Given an N × N matrix of positive integers, find the shortest path from the first cell of the matrix to its last cell that satisfies given constraints.
Given a positive number N, print an N × N spiral matrix containing numbers from 1 to N × N in a counterclockwise direction and without extra space.
Given a rectangular field with few sensors present, cross it by taking the shortest safe route without activating the sensors.
Given an M × N matrix of characters, find all occurrences of a given string in the matrix. We are allowed to search the string in all eight possible directions. Note that there should not be any cycles in the output path.
Given an array, find the total number of inversions of it. If (i < j) and (A[i] > A[j]), then pair (i, j) is called an inversion of an array A. We need to count all such pairs in the array.
The external merge sort algorithm is used to efficiently sort massive amounts of data when the data being sorted cannot be fit into the main memory (usually RAM) and resides in the slower external memory (usually a HDD).