Skip to content

Latest commit

 

History

History
11 lines (9 loc) · 546 Bytes

README.md

File metadata and controls

11 lines (9 loc) · 546 Bytes

Nuts-and-Bolts-Problem

Given a set of N nuts of different sizes and N bolts of different sizes. There is a one-one mapping between nuts and bolts. Match nuts and bolts efficiently. Comparison of a nut to another nut or a bolt to another bolt is not allowed. It means nut can only be compared with bolt and bolt can only be compared with nut to see which one is bigger/smaller. The elements should follow the following order ! # $ % & * @ ^ ~ .

Input: N = 5 nuts[] = {@, %, $, #, ^} bolts[] = {%, @, #, $ ^}

Output:

$ % @ ^

$ % @ ^