Блог пользователя rajkumar62506

Автор rajkumar62506, история, 23 месяца назад, По-английски

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<=A[i],B[i],n<=50

1<=k<=n

  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

  • Проголосовать: нравится
  • +7
  • Проголосовать: не нравится

»
23 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by rajkumar62506 (previous revision, new revision, compare).

»
23 месяца назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by rajkumar62506 (previous revision, new revision, compare).