Construct the longest palindrome by shuffling or deleting characters from a string
Write an efficient algorithm to construct the longest palindrome by shuffling or deleting characters from a given string.
Ace your Coding Interview
Get hired by top tech companies with our comprehensive interview preparation.
Get StartedWrite an efficient algorithm to construct the longest palindrome by shuffling or deleting characters from a given string.
Given an unsorted integer array containing many duplicate elements, rearrange it such that the same element appears together and the relative order of the first occurrence of each element remains unchanged.
Given a string, find the first non-repeating character in it by doing only one traversal of it.
Given an unsorted integer array whose elements lie in the range 0 to n-1 where n is the array size, calculate the frequency of all array elements in linear time and using constant space.
Given an M × N matrix, Function to find all common elements present in every row.
Given an array of distinct integers, replace each array element by its corresponding rank in the array. The minimum array element has the rank 1; the second minimum element has a rank of 2, and so on…
Given an integer array, find the minimum index of a repeating element in linear time and doing just one traversal of the array.
Given an integer array, find the index of the maximum occurring element with an equal probability.
Given an integer array, check if only consecutive integers form the array.
Given an unsorted integer array, find two non-overlapping pairs in it having the same sum.
Given two strings, determine if the first string can be transformed into the second string. The only operation allowed is moving a character from the first string to the front. If the string can be transformed, find the minimum number of operations required for the transformation.
Given a binary tree, write an efficient algorithm to print its right view. For example, the right view of a given binary tree is 1, 3, 6, 8.