Company: Media Net .
Difficulty: medium
Double Box Outlay II Problem Description Malia is shopping at a card store for a two-player game night. The store has N boxes on the shelf, each holding a distinct set of M numbered cards. She needs cards for two people, so she wants to buy exactly two boxes as cheaply as possible, on the condition that the two boxes share no numbered card in common. Help Malia work out the cheapest way to buy two such non-overlapping boxes. You are given 2D array A of size N cross M, where A[i][j] represents the j-th numbered card of i-th box. You are also given an array B of size N, where B[i] represents the cost of i-th box. Find the minimum cost he must incur to buy these two non-overlapping sets of cards. If no such pair of boxes exists, return -1. Note: There can be two or more boxes with the same price, the same cards, or both. Constraints 2 <= N <= 10^4 1 <= M <= 4 1 <= A[i][j], B[i] <= 10^9 Input Format First argument is a 2D array of integers A Second argument is an array of