Java Simplest solution
\nclass Solution {\n    public int minNumberOfHours(int a, int b, int[] A, int[] B) {\n        int maxA = 0;\n        int maxB = 0;\n        for (int i = 0; i <
```\nclass Solution {\n    public int minNumberOfHours(int a, int b, int[] A, int[] B) {\n        int maxA = 0;\n        int maxB = 0;\n        for (int i = 0; i < A.length; i++) {\n            maxA = Math.max(maxA, A[i]-a+1);\n            maxB = Math.max(maxB, B[i]-b+1);\n            a -= A[i];\n            b += B[i];            \n        }\n        return maxA + maxB;\n    }\n}\n```
['Java']