Company: goldman sachs

Difficulty: medium

Problem Statement

Warehouse Bag Total Capacity Check You receive an order containing N items. The i -th item has weight K[i] kilograms. The customer supplied B shopping bags, and every bag can carry at most 10 kilograms, so the supplied bags provide a combined capacity of 10 * B kilograms. Print Yes if the combined weight of all N items is at most the combined capacity of the B bags; otherwise print No . Input Format The first line contains N . The second line contains N integers K[i] . The third line contains B . Output Format Print Yes or No . Constraints 1 <= N <= 1000 , 1 <= K[i] <= 10 , 1 <= B <= 100 . Notes This is a total-capacity comparison: compare the sum of all item weights against 10 * B . You are not asked whether the items can actually be distributed into individual bags without splitting an item. A total weight that fits within the combined capacity counts as Yes even when no such distribution exists. Example Input: 3 6 6 6 2 Output: Yes The three items weigh 18 kg in to

More goldman sachs OA questionsInterview experiences