Google Online Coding Challenge 23rd July

Google · Question · Posted Jul 2022

<h2>Problem 1 - Swapping Pairs</h2> <problem>304</problem> <p> You are given N pairs namely {a<sub>1</sub>, b<sub>1</sub>}, {a<sub>2</sub>, b<sub>2</sub>}, ... ,{a<sub>N</sub>, b<sub>N</sub>}<br> You are also given an integer M. </p> <p> You can swap any pair, that is, for the i<sup>th</sup> pair, a<sub>i</sub> becomes b<sub>i</sub> and b<sub>i</sub> becomes a<sub>i</sub>. You have to apply the operation in such way such that a<sub>1</sub> + a<sub>2</sub> + a<sub>3</sub> + ... + a<sub>N</sub> = M. </p> <p> Your task is to determine whether the condition be ...

The full answer & interview discussion are available to premium members.

Log in Create a free account