Permuting Two Arrays, is a HackerRank problem from Greedy subdomain. In this post we will see how we can solve this challenge in Python

Problem Description

Consider two -element arrays of integers, and . You want to permute them into some and such that the relation holds for all where

. For example, if , , and , a valid satisfying our relation wo ....

You can find the full details of the problem Permuting Two Arrays at HackerRank

Solution: Please check the snippet for the solution.

Solution originally posted at: Github by @marinskiy