Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Summation rule thing?
- // given array of length n:
- // var best = 0
- for(hi <- 1 to n) {
- for(lo <- 1 to hi) {
- // var sum = 0
- for(i <- lo to hi) {
- sum += a(i)
- }
- best = best max sum
- }
- }
- return best
- sum_{hi=1..n} sum{lo=1..hi} sum{i=lo..hi} 1
- sum_{hi=1..n} sum{lo=1..hi} hi-lo+1
- https://gyazo.com/5cc9d1f57e76e34f3503337e996b95c9
- https://gyazo.com/642717f29acfb00d55896a40ec592a1f
- https://gyazo.com/88d9877837ed467ca6530cd275610435
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement