Math 3492. Maximum Containers on a Ship ¶ Time: $O(1)$ Space: $O(1)$ C++JavaPython 1 2 3 4 5 6class Solution { public: int maxContainers(int n, int w, int maxWeight) { return min(n * n, maxWeight / w); } }; 1 2 3 4 5class Solution { public int maxContainers(int n, int w, int maxWeight) { return Math.min(n * n, maxWeight / w); } } 1 2 3class Solution: def maxContainers(self, n: int, w: int, maxWeight: int) -> int: return min(n * n, maxWeight // w)