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.

#### Maximum Path with the Same Labels

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 ...
Berkan Teber
Published on Jan 15th, 2018

#### Minimum Number of Multiplication in Matrix Multiplication

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 ...
Berkan Teber
Published on Jan 15th, 2018

#### Find Longest Substring with k Unique Characters

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 ...
Berkan Teber
Published on Jan 15th, 2018

#### Minimum Number of Swaps Required to Arrange Pairs Adjacent to Each Other

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 ...
Berkan Teber
Published on Jan 15th, 2018

#### Sum of Bit Differences Among All Pairs

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 ...
Berkan Teber
Published on Jan 15th, 2018

#### Paper Cut into Minimum Number of Squares

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 ...
Berkan Teber
Published on Jan 15th, 2018

#### Longest Possible Chunked Palindrome

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 ...
Berkan Teber
Published on Jan 15th, 2018

#### Alphanumeric Abbreviations of a String

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 ...
Berkan Teber
Published on Jan 15th, 2018

#### Number of Ways to Transform a String into a Substring

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 ...
Berkan Teber
Published on Jan 15th, 2018

#### Sort an Array with Swapping Only with a Special Character

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 ...
Berkan Teber
Published on Jan 15th, 2018