I’m not too sure on how to start coding it so that it doesn’t run into TLE errors. Does anyone have any hints/tips on how to get started for this question? I understand the problem, but I don’t want to use nested for loops and basically brute force it because time limit is 1s, and I’m on python
keep a running tally of each prefix sum as you iterate through the array
previous prefix sums can be subtracted from each prefix sum to create desired sum
and if you’re still getting TLE, a tip would be to put the entire code into a function, then call it
When I was using python, I found that doing that would cut down on time massively