@StefanPochmann The only case where this logic will not succeed is when input is taking Integer.MIN_VALUE like [-2147483648,0] where k=0. But yes in this question it says: 'Given a list of non-negative numbers'.

Continuous Subarray Sum

Continuous Subarray Sum