r/shittyprogramming • u/Abdul_Alhazred_ • Aug 08 '19
My solution to the Maximum Subarray Sum problem... please end my miserable existence
120
Upvotes
r/shittyprogramming • u/Abdul_Alhazred_ • Aug 08 '19
16
u/green_meklar Aug 08 '19
Only cubic time? I'm sure we can get shittier than that. How about:
36
u/Spritetm Aug 08 '19
What is shitty about this? It could have used some more comments, and I'm sure it's not the fastest algo ever, but for a naive implementation, it doesn't look half bad.
10
u/Qesa Aug 08 '19 edited Aug 08 '19
FYI
2
u/Arjunnn Aug 10 '19
Offtopic, but what's that editor and theme? Looks fantastic
1
u/ShortCellar Aug 08 '19
Isn't this problem O(2n ) anyway?