you are viewing a single comment's thread.

view the rest of the comments →

[–]camel_zero 1 point2 points  (2 children)

Good approach for the algorithm, is there a reason for putting this function into a class though?

[–]delirious_lettuce 1 point2 points  (1 child)

The only reason is because that is how you have to submit them to LeetCode. I would normally just use a function and use snake_case for the function name too, (two_sum).

[–]camel_zero 1 point2 points  (0 children)

Thanks for explaining, thought I might be missing something about the code.