Tcs Coding Questions 2021 Review

return max_sum

Example: Input - 1 -> 2 -> 3 -> 4 -> 5, Output - 3

Example: Input - [1, 2, 3, 4, 5], target sum - 7, Output - 2

def max_subarray_sum(arr): max_sum = float('-inf') current_sum = 0

return max_sum

Example: Input - 1 -> 2 -> 3 -> 4 -> 5, Output - 3

Example: Input - [1, 2, 3, 4, 5], target sum - 7, Output - 2

def max_subarray_sum(arr): max_sum = float('-inf') current_sum = 0

Todos los derechos reservados. Rembli © 2023 | Powered by Voriqa