Practice Maximum Containers on a Ship
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given a positive integer n representing an n x n cargo deck on a ship. Each cell on the deck can hold one container with a weight of exactly w. 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.
Source: Maximum Containers on a Ship on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
n = 2, w = 3, maxWeight = 15
4
# Example 2
n = 3, w = 5, maxWeight = 20
4
Constraints
Related LeetCode Problems
Practice more problems similar to Maximum Containers on a Ship.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.