There are n pairs and therefore 2n people. Everyone has one unique number ranging in 1..2n. All these 2n persons are arranged in random fashion in an array of size 2n. We are also given who is partne …
Longest Possible Chunked Palindrome
Given a string of characters of length less than 10, return all the alpha-numeric abbreviations of the string (in lexicographic order). The alpha-numeric abbreviation is in the form of characters mi …
Number of Ways to Transform a String into a Substring
Given a string, the task is to return the length of its longest possible chunked palindrome. It means a palindrome formed by substrings. For better understanding, look at the examples below. Example …
Alphanumeric Abbreviations of a String
Given the dimensions of n matrices M1..Mn, what is the minimum number of multiplication in M1 x M2 x … x Mn. Example: Suppose dimensions are given as [10, 30, 5, 60], meaning 3 matrices with dime …
Consider an undirected tree with N nodes, numbered 1..N. Each node has a label associated with it, which is an integer value. Different nodes can have the same label. You are given a zero indexed arr …
Sort an Array with Swapping Only with a Special Character
Given a string you need to print longest possible substring that has exactly k unique characters. If there are more than one substring of longest possible length, return the lexicographically largest …
Sum of Bit Differences Among All Pairs
Given a paper of size A x B, the task is to cut the paper into squares of any size. Find the minimum number of squares that can be cut from the paper. Example: When paper size is 36 x 30, the outpu …
Paper Cut into Minimum Number of Squares
Given an array of length n + 1, containing elements 1..n and a special character 999 , write a function that sorts the array using only swaps with the special character. In other words, you can only …
Minimum Number of Swaps Required to Arrange Pairs Adjacent to Each Other
Minimum Number of Multiplication in Matrix Multiplication
Given an integer array of n integers, find sum of bit differences in all pairs that can be formed from array elements. Bit difference of a pair (x, y) is count of different bits at same positions in …
Find Longest Substring with k Unique Characters
Google LLC is an American multinational technology company that specializes in Internet-related services and products. These include online advertising technologies, search, cloud computing, software, and hardware.
Given two sequences A and B, find out number of unique ways to transform sequence A into sequence B. Transformation means converting string A (by removing 0 or more characters) to string B. Examples …