SAMSUNG R&D Noida | On-site OA | April 2025
- Location
- Noida
- Posted
- 12 Apr 2025
Summary
I encountered a coding problem during my Samsung R&D On-site Online Assessment in April 2025 involving medicine bottle delivery optimization.
How it went
Given N medicine bottles and M containers and each container has capacity to carry W[i] bottles.
The delivery van can take two containers (only one can also be loaded) to nearby hospital in single trip. Containers can be reused.
Find number of trips to deliver minimum N bottles. If not possible, print -1
Contraints
1 <= N,M,W[i] <= 1000
W.length == M
N = 5, M = 2 W[] = {1, 3} Output = 2
N = 6, M = 2 W[] = {4, 5} Output = -1
N = 720, M = 5 W[] = {27, 52, 119, 144, 124} Output = 5
I tried using 2d/3d DP but got TLE.
Questions asked (1)
- 01
Minimum Trips to Deliver Medicine Bottles
Data Structures & Algorithms
Given
Nmedicine bottles andMcontainers and each container has capacity to carryW[i]bottles. The delivery van can take two containers (only one can also be loaded) to nearby hospital in single trip. Containers can be reused. Find number of trips to deliver minimumNbottles. If not possible, print -1Contraints
1 <= N,M,W[i] <= 1000W.length == MN = 5, M = 2 W[] = {1, 3} Output = 2
N = 6, M = 2 W[] = {4, 5} Output = -1
N = 720, M = 5 W[] = {27, 52, 119, 144, 124} Output = 5