Amazon Online Assessment
Anonymous User
4291

Question 1
Array with XOR equal X

Question 2
Min Abs Diff Between 2 Elements

Question 3
Determine the minimum number of mergers that must be peformed between car companies to ensure that a market is controlled by no more than two seperate companies. A merger between two companies result in a single company that controls the same markets as the two previous companies.
Input Format:
First Line: An integer n denoting the number of car companies.
Second line: An integer m denoting the number of markets controlled by each company
Each ith of the next n lines(where 0<=i<n) contains: m space seperated integers denoting the market ID of the market controlled by comany i
Constraints:
1<=n<=5
1<=m<=3
1<=market_id<=10^5
Sample input:
2
2
1 2
2 3
Output:
0

Comments (8)