We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Your solution was really smart, but i have to undertand why you added the negative K (a[q+1]-=sum;) at the end of the interval and i have to mitigate the execution time finding the real range from n array and, at the moment of adding, avoid all the cero elements to performe the add (x=x+a[i]) and max comparation.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Array Manipulation
You are viewing a single comment's thread. Return to all comments →
Your solution was really smart, but i have to undertand why you added the negative K (a[q+1]-=sum;) at the end of the interval and i have to mitigate the execution time finding the real range from n array and, at the moment of adding, avoid all the cero elements to performe the add (x=x+a[i]) and max comparation.