[
[“userId”, “first”, “last”, “priority”, “groupId”],
[“12345”, “John”, “Doe”, “5”, “group1”],
[“12345”, “John”, “Doe”, “7”, “group1”],
[“12345”, “John”, “Doe”, “1”, “group1”],
[“123456”, “Jane”, “Doe”, “5”, “group2”],
[“123456”, “John”, “Doe”, “5”, “group3”],
[“1857”, “Mike”, “Howard”, “5”, “group4”],
[“1857”, “Mike”, “Howard”, “9”, “group4”],
[“12345”, “Bob”, “Forbes”, “1”, “group5”]
]
If two user ID’s belong to the same group, only keep the array with the highest priority. I’ve tried nested for loops but I am still stuck. The typical array duplicate solution wouldn’t work because joining the array doesn’t make it unique. Any pointers?