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...


C++, do not sort the array.


Given a set of N nuts of different sizes and N bolts of different<br>sizes. There is a one-one mapping between nuts and bolts. Match<br>nuts and bolts efficiently.<br>Comparison of a nut to another nut or a bolt to another bolt is not<br>allowed. It means nut can only be compared with bolt and bolt can<br>only be compared with nut to see which one is bigger/smaller.<br>The elements should follow the following order ! # $ % & * @^~.<br>Example 1:<br>Input:<br>N = 5<br>nuts[] = {@, %, $, #, ^}<br>{%, @, #, $ ^}<br>%3D<br>bolts[]<br>Output:<br># $ % @<br>#<br>

Extracted text: 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 ! # $ % & * @^~. Example 1: Input: N = 5 nuts[] = {@, %, $, #, ^} {%, @, #, $ ^} %3D bolts[] Output: # $ % @ #

Jun 07, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here