From 1b465859a4ad9d099b7d50ee4aa17bb0c77952bd Mon Sep 17 00:00:00 2001 From: Tulika Shivani <46400148+Tulika-Shivani@users.noreply.github.com> Date: Thu, 22 Oct 2020 00:43:52 +0530 Subject: [PATCH] Create 0053.cpp --- C++/0053.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 C++/0053.cpp diff --git a/C++/0053.cpp b/C++/0053.cpp new file mode 100644 index 0000000..c633eaa --- /dev/null +++ b/C++/0053.cpp @@ -0,0 +1,20 @@ +class Solution { +public: + int maxSubArray(vector& nums) { + int n=nums.size(),i; + int res=INT_MIN; + vector dp(n,0); + // dp[i] is the maximum sum subarray ending at i; + //Smallest Subproblem + dp[0]=nums[0]; + for(i=1;i