<prompt> Given a problem, design an algorithm to solve it.Given an array of n integers, find the maximum sum of consecutive elements in the array.  <response>: Here is a step-by-step algorithm to solve the given problem:1. Initialize a variable, max_sum, to store the maximum sum of consecutive elements, and set its value equal to the first element of the array.2. Initialize another variable, current_sum, to store the current sum of consecutive elements, and set its value equal to the first element of the array.3. Iterate over the array from the second element to the end: a. If the value of current_sum is positive, add the current element to it, else set the value of current_sum equal to the current element. b. Compare current_sum with max_sum and update the value of max_sum if current_sum is greater than max_sum.4. Return max_sum as the maximum sum of consecutive elements in the array.This is the well-known Kadanes Algorithm, with a time-complexity of On that solves the problem of finding the maximum sum of a subarray in a given one-dimensional array. 