We have a task to compare each input key with others to find any common values. If there are common values, we need to concatenate them together and display the pairs. If no common values are found, then an empty array should be displayed as output.
input :
{
"harsh" : ["cricket", "vollyball"],
"aasim" : ["cricket", "football", "ludo", "COD", "rugb", "vollyball", "Racing"],
"jignesh" : ["cycling", "cricket"],
"jimish" : ["cycling"],
"prince" : ["vollyball","football"],
"raj" : ["ludo","cricket","cycling"]
}
output :
{
"harsh, aasim":["cricket","vollyball"],
"harsh, jignesh":["cricket"],
"harsh, jimish":[],
"harsh, prince":["vollyball"],
"harsh, raj":["cricket"],
"aasim, jignesh": ["cricket"],
"aasim, jimish": [],
"aasim, prince": ["vollyball","football"],
"aasim, raj": ["ludo","cricket"],
"jignesh, jimish" : ["cycling"],
"jignesh, prince" : [],
"jignesh, raj" :["cycling"],
"prince, raj" : []
}