3492. Maximum Containers on a Ship
You are given a positive integer
n
representing ann x n
cargo deck on a ship. Each cell on the deck can hold one container with a weight of exactlyw
.However, the total weight of all containers, if loaded onto the deck, must not exceed the ship’s maximum weight capacity,
maxWeight
.Return the maximum number of containers that can be loaded onto the ship.
c++
1 | class Solution { |