Oracle | OA | VNIT Nagpur | Internship | 2023 | Minimum Moves | Red or Blue | Rest API : Countries by Region | Rearrange Students

Oracle · Question · Posted Jul 2023

Minimum Moves   There are two arrays of integers, arr1 and arr2. One move is defined as an increment or decrement of one element in an array. Determine the minimum number of moves to match arr1 with arr2. No reordering of the digits is allowed. Example arr1 = [123, 543] arr2 = [321, 279] Match arr 1[0]-123 with arr2[0]=321. Increment- twice to get 3 (2 moves) Decrement twice to get 1 (2 moves),  4 moves are needed to match 123 ...

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

Log in Create a free account