⌚ONE-LINER⌚| O(1)🚀 || [C++/Java/Py3/JS]⚡EASY SOLUTION w EXPLANATION🍨
IntuitionThe problem requires us to determine the maximum number of containers that can be placed on an n x n cargo deck while ensuring the total weight does no
## Intuition

The problem requires us to determine the maximum number of containers that can be placed on an `n x n` cargo deck while ensuring the total weight does not exceed `maxWeight`.  

- The deck can hold at most `n * n` containers.  
- Each container has a weight of `w`, so the total weight of all `k` containers is `k * w`.  
- The ship's weight limit `maxWeight` restricts how many containers can be placed.  

Thus, we take the minimum of `n * n` (the deck's maximum capacity) and `maxWeight / w` (the weight-constrained maximum).

---

# Approach

1. Compute the total number of containers that the `n x n` deck can hold:  
  ` max_possible = n × n`
2. Compute the maximum number of containers that the ship can support under the weight constraint:  
   `max_by_weight = ⌊maxWeight / w⌋`
3. Return the minimum of these two values:  
   `result = min(max_possible, max_by_weight)`
---

# Complexity

- **Time Complexity:** `O(1)`
- **Space Complexity:** `O(1)`
---

# Code

```C++ []
class Solution {
public:
    int maxContainers(int n, int w, int maxWeight) {
        return (n*n > maxWeight/w) ? maxWeight / w : n*n;
    }
};
```
```python3 []
class Solution:
    def maxContainers(self, n: int, w: int, maxWeight: int) -> int:
        return (n * n if n * n <= maxWeight // w else maxWeight // w)
```

```java []
class Solution {
    public int maxContainers(int n, int w, int maxWeight) {
        return (n*n > maxWeight/w) ? maxWeight / w : n*n;
    }
}
```

```javascript []
/**
 * @param {number} n
 * @param {number} w
 * @param {number} maxWeight
 * @return {number}
 */
var maxContainers = function (n, w, maxWeight) {
    return (n * n > Math.floor(maxWeight / w)) ? Math.floor(maxWeight / w) : n * n;

};
```


```

✨ AN UPVOTE WILL BE APPRECIATED ^_~ ✨
```
['Math', 'Python', 'C++', 'Java', 'Python3', 'JavaScript']