r/shittyprogramming • • Apr 10 '19

One Line of Code™

https://gist.github.com/WorryingWonton/ce8a3a74b0298f0b734fe4dd0a883a63
101 Upvotes

22 comments sorted by

View all comments

Show parent comment

1

u/CVh655FDBcZ1l Apr 10 '19

I did the 'level 3' Array and String problem sets off CodingBat in Python recently. I solved them using a decent number of lambda and list comprehension expressions. I used the same split()-join()-list comprehension approach to two problems in the String-3 set (gHappy and countYZ), where doing so makes far more sense. I thought it'd be fun to see if I could apply that approach elsewhere... The result is a 580 character lambda expression with O(n!) complexity.

My Array-3 and String-3 Python Attempts + all public tests