r/badcode • • Jun 19 '21

typescript Check if binary tree is balanced...

Post image
221 Upvotes

44 comments sorted by

View all comments

123

u/pedro823 Jun 19 '21

Frankly, LGTM. Not hard to understand, variables with somewhat decent names, and no blatant optimizations to be seen.

-62

u/MrPancholi Jun 19 '21

It does work, but I just thought that the tuple thing I did was a little weird.

I suck with algorithms so I though this was pretty far form the ideal solution.

69

u/dliwespf Jun 19 '21

Since this seems to be your own code: Don't shame yourself, your code is quite alright.

And additionally: You seem to try to improve your own coding style. So in my opinion you are doing well!