共 90 分钟,记得2题

  1. Given an array of positive integers, divide in two parts A and B such the sum of elements in A is strictly greater than the sum of elements in B, also A and B must be disjoint and A should be of minimum size possible. If there are multiple possiblities for A, return the one with highest sum.
    Example : Let given arr is [8,1,2,9,1] then A = [9,8].
  2. Given four array of prices of four different items and the total money that Alice has. Count the number of combinations such that Alice can buy at least one item from each group. For example if Alice’s budget is 10, and the prices are Item 1:[2,3] Item 2:[4] Item 3:[1,2] Item 4:[2,2] . Then the possible combination such that at least one item from each item list is bought are 2+4+1+2,3+4+1+2,2+4+2+2,etc.
1 Like