Skip to content

Commit dd21ca3

Browse files
authored
Create maximum-containers-on-a-ship.cpp
1 parent de5edb5 commit dd21ca3

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

C++/maximum-containers-on-a-ship.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// Time: O(1)
2+
// Space: O(1)
3+
4+
// math
5+
class Solution {
6+
public:
7+
int maxContainers(int n, int w, int maxWeight) {
8+
return min(maxWeight / w, n * n);
9+
}
10+
};

0 commit comments

Comments
 (0)