3 3 votes Maximum Subarray Sum problem is to find the subarray with maximum sum. For example, given an array {12, -13, -5, 25, -20, 30, 10}, the maximum subarray sum is 45. The naive solution for this problem is to calculate sum of all subarrays starting with every element and return the maximum of all. We can solve this using Divide and Conquer, what will be the worst case time complexity using Divide and Conquer. A O(n) B O(nLogn) C O(Logn) D O(n2) Correct answer is B. O(nLogn) How? Algorithms divide-and-conquer algorithms + – Rishav Kumar Singh 8.1k views answer comment Share Follow Print See all 3 Comments 3 3 Comments reply Sumit Singh Chauhan commented Jul 29, 2018 reply Follow flag I think that the answer needs to be O(n), We can use dynamic programming to solve it. Please refer : https://www.geeksforgeeks.org/largest-sum-contiguous-subarray/ 0 0 replyShare MiNiPanda commented Jul 29, 2018 reply Follow flag Have you gone through this algo? https://www.geeksforgeeks.org/divide-and-conquer-maximum-sum-subarray/ Sumit Singh Chauhan The question is asking about the Divide and Conquer implementation 1 1 replyShare Sumit Singh Chauhan commented Jul 30, 2018 reply Follow flag Oh Yes, thanks for noticing the answer will be O(nlogn) using divide and conquer. O(n) is possible only via Dynamic Programming using Kadane’s Algorithm. 0 0 replyShare Please log in or register to add a comment.