5

Solving leetcode problems for fun, as I’m highly interested in algorithm problems....and I go to the area where the discussion is, and this spaghetti is the first thing I see 😱

Comments
  • 1
    It's kinda ugly but also kinda simple
  • 1
    The cyclomatic complexity is 20 its far from simple 😬
  • 0
    @Spacecase94 I don't even know what that is lol
  • 1
    That stupid thing looks like a homework solution for a truly dumb question. Probably how to handle realllllly large numbers using linked lists (for some bizzare reason).
  • 0
    This was my solution lol
  • 0
    Here’s the second half
  • 1
    @Spacecase94 Ever heard about big decimal?
    use that. never reinvent the circle. As a triangle....
  • 0
    Big decimal? Never heard of it. I’ll have to google it
  • 1
    @magicMirror so upon googling the big decimal class I’m confused how I could use that to add the integer values of 2 separate linked lists in reversed order and process them simultaneously and return a 3rd linked list with the sum of the reversed nodes in the 2 linked lists
  • 0
    @magicMirror It's basically code golf. He's not writing a library
  • 0
    @12bitfloat exactly that’s a great analogy “code golf”
  • 0
    @Spacecase94 What are they teaching you there? My suggestion: find an uzi, or better yet, an mk47 with a big magazine, and go to to town...

    Or maybe - write a linked list to BigDecimal method, and then a BigDecimal to linked list method, and then refactor that stupidass method in 1 line:

    return ToList(ToDecimal(lista)+ToDecimal(listb))
  • 1
    @magicMirror it’s leetcode basically algorithm practice for technical interview questions. I quit playing video games and now algorithms are my new addiction
Add Comment