Started Leetcode today, First problem was to add two numbers (ik, very easy but still, link: https://leetcode.com/problems/add-two-integers/).
My answer is of five lines but the compiler says it has detected two errors on line 29 and 39
My answer:
num1 = 12
num2 = 5
sum = num1 + num2
print(sum)
Compiler error:
NameError: global name 'Solution' is not defined
ret = Solution().sum(param_1, param_2)
Line 29 in _driver (Solution.py)
_driver()
Line 39 in <module> (Solution.py)
Which makes absolutely no sense as there is no such line in my code
I have tried reloading, closing tab, etc. but to no effect. What am I doing wrong?
This photo contains the screenshot of the problem and my solution along with compile errors.
classanddef? try this :class Solution: def sum(self, num1: int, num2: int) -> int: return num1 + num2