Skip to content

Complete Competitive-Coding-2#1164

Open
PrakarshKamal wants to merge 1 commit intosuper30admin:masterfrom
PrakarshKamal:master
Open

Complete Competitive-Coding-2#1164
PrakarshKamal wants to merge 1 commit intosuper30admin:masterfrom
PrakarshKamal:master

Conversation

@PrakarshKamal
Copy link

No description provided.

@super30admin
Copy link
Owner

Your solution for the TwoSum problem is excellent. It is efficient with O(n) time complexity and uses a HashMap to achieve this. The code is clear and concise. However, you included code for the knapsack problem in the same submission. This is not relevant to the TwoSum problem and might indicate that you submitted the wrong files or mixed up problems. In the future, ensure that you only submit the solution for the problem at hand.

For the TwoSum part:

  • Well done on using the HashMap to store the numbers and their indices.
  • The logic for checking the complement is correct and efficient.
  • The code is well-structured and easy to read.

Please double-check your submissions to make sure they are for the correct problem.

@super30admin
Copy link
Owner

Your solution for the twoSum problem is excellent. It efficiently solves the problem in O(n) time and O(n) space, which is optimal. The code is clean and easy to understand. Well done!

However, please note that you included a solution for the knapsack problem in the same submission. This might be an error, as the problem asked specifically for the two-sum problem. In the future, ensure that you only submit code relevant to the problem at hand. If this was intentional (for example, to show additional work), it's better to separate it clearly or mention it in comments.

For the twoSum solution, you might consider adding a comment explaining the approach briefly, but it is not necessary as the code is self-explanatory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants