Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/incrementaltest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
class Solution:
def twoSum(self, nums, target):
mapp = {}

for num in nums:
if target - num in mapp:
return [num, mapp[target - num]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 Code Bugs

This line is missing the closing bracket ], making it a syntax error that prevents the entire file from being parsed.

Details

📖 Explanation: The list literal is never closed, causing a SyntaxError at runtime.

Suggested change
return [num, mapp[target - num]
return [num, mapp[target - num]]

Uses AI. Verify results. Give Feedback

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 Code Bugs

Missing a closing bracket ], causing a SyntaxError; it should be return [num, mapp[target - num]].

Details

📖 Explanation: The return statement on line 7 is missing its closing bracket, making this a syntax error that will prevent the entire module from loading.

Suggested change
return [num, mapp[target - num]
return [num, mapp[target - num]]

Uses AI. Verify results. Give Feedback

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 Code Bugs

This line has a missing closing ] bracket, which will cause a SyntaxError at runtime.

Details

📖 Explanation: Missing closing bracket causes a SyntaxError.

Suggested change
return [num, mapp[target - num]
return [num, mapp[target - num]]

Uses AI. Verify results. Give Feedback

mapp[num] = num

def maxProduct(self, nums):
max_prod = nums[0]
min_prod = nums[0]
result = nums[0]

for i in range(1, len(nums) - 1):
num = nums[i]
max_prod, min_prod = max(num, max_prod * num, min_prod * num), min(num, max_prod * num, min_prod * num)
result = max(result, max_prod)

return result
Loading