algorithms.tutorialhorizon.com

Nuts & Bolts Problem (Lock & Key problem) | Algorithms

Given 'n' Nuts and 'n' Bolts of different sizes. There is one-to-one mapping between nuts and bolts. Write an algorithm to find all matches between nuts and bolts This problem can also be framed as- Given 'n' keys and 'n' locks. There is one-to-one mapping between keys and locks, means each lock has a specific key and can be unlocked using that key only. Write an algorithm to find all matches between keys and locks.