From 1282b9a29191d80c74f72fa6907bfdc1cc4f5891 Mon Sep 17 00:00:00 2001 From: jatin-singh-kushwaha <164042889+jatin-singh-kushwaha@users.noreply.github.com> Date: Tue, 29 Oct 2024 13:42:20 +0530 Subject: [PATCH] Create prefixSumQ.cpp --- prefixSumQ.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 prefixSumQ.cpp diff --git a/prefixSumQ.cpp b/prefixSumQ.cpp new file mode 100644 index 0000000000..67f147c7dc --- /dev/null +++ b/prefixSumQ.cpp @@ -0,0 +1,32 @@ +// given an integers array a,return the prefix sum/running sum in the same array without creating a new array + +#include +#include +using namespace std; + +void runingSum(vector &v){ +for(int i=1;i>n; +vectorv; +for(int i=0;i>ele; + v.push_back(ele); +} + +runingSum(v); + +for(int i=0;i