Determine if the current value of 'H' cuts at least 'k' meters of wood.
| 20 | // Determine if the current value of 'H' cuts at least 'k' meters of |
| 21 | // wood. |
| 22 | bool cutsEnoughWood(int H, int k, std::vector<int>& heights) { |
| 23 | int woodCollected = 0; |
| 24 | for (int height : heights) { |
| 25 | if (height > H) { |
| 26 | woodCollected += (height - H); |
| 27 | } |
| 28 | } |
| 29 | return woodCollected >= k; |
| 30 | } |
no outgoing calls
no test coverage detected