Back to problems

Pin Board Connectivity

Algorithm · Pinterest · Medium

You are given a collection of boards, each represented by a list of distinct positive integers called pins. Two pins are related if you can reach one from the other by traveling through shared boards — moving from a pin to any board that contains it, then to any other pin on that board, and repeating this process as many times as needed. A pin can belong to more than one board. Write a function that takes boards, pin1, and pin2 and returns true if the two pins are related;…

Checking your access…