Interesting Problems — help needed

Revision en3, by rajkumar62506, 2022-05-15 05:29:04

Hello Coders, Recently In online test of BNY company these two questions were asked. It will be great if someone can give approach to solve these questions.

  1. Given two arrays of integer A and B of length n. We have to choose k indexes such that min(Sum of elements of A at chosen indexes, sum of elements of B at chosen indexes) is maximized. We have to return that maximum sum.



  1. Given integer array A of length n. Initially our power will be 0. Now in one operation we can choose two indexes i and j, i != j. Now we can add A[i] ^ A[j] to power and have to remove any one element. So after n — 1 operation we will be left with only 1 element. At that point we have to stop the process. We have to return what is the maximum power we can collect.

1 <= n <= 1000

1 <= A[i] <= 10^9

Tags online test, help, coding


  Rev. Lang. By When Δ Comment
en3 English rajkumar62506 2022-05-15 05:29:04 4
en2 English rajkumar62506 2022-05-15 05:28:14 26
en1 English rajkumar62506 2022-05-15 05:27:07 867 Initial revision (published)