Data Structures & AlgorithmsVery hardGATE CS · TCS NQT
Four items of weight 4 each must be shipped in 2 boxes of equal capacity C (each box must hold whole items). What is the smallest feasible C?
- A. 4
- B. 8
- C. 16
- D. 6
Correct answer: B. 8
Each box must hold two items of weight 4, so C must be at least 8. Capacity 6 holds only one item per box, which leaves items unshipped.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- What is the minimum absolute difference between two distinct elements of [12, 5, 9, 1, 15, 7]?
- How many distinct characters occur at least twice in "programming"?
- With 1-based indexing, what is the sum of i times a[i] for a = [2, 0, 3, 1]?
- For [1, 0, 1, 1, 0, 1, 0, 1], consider windows of length 4. In each window you may flip at most one 0 to 1. What is the largest number of…
- Over all windows of size 3 in [4, 8, 2, 7, 5, 9], what is the smallest value of (window max minus window min)?
- How many index pairs i < j of length-2 substrings of "ababa" are equal strings?