yashvardhan-rustedlegend / 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 a nut to see which one is bigger/smaller. The elements should follow the following order! # $ % & * @ ^ ~ .

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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:

$ % @ ^

$ % @ ^

About

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 a nut to see which one is bigger/smaller. The elements should follow the following order! # $ % & * @ ^ ~ .

License:GNU General Public License v3.0


Languages

Language:C++ 100.0%