Skip to content

Complete17_18_19#2176

Open
dhruvil15 wants to merge 1 commit into
super30admin:masterfrom
dhruvil15:master
Open

Complete17_18_19#2176
dhruvil15 wants to merge 1 commit into
super30admin:masterfrom
dhruvil15:master

Conversation

@dhruvil15
Copy link
Copy Markdown

No description provided.

@super30admin
Copy link
Copy Markdown
Owner

Subarray Sum Equals K (Problem17.java)

**
Your solution is excellent! It correctly implements the optimal approach for this problem. Here are some strengths:

  • You used a hash map to efficiently track the frequency of running sums, which is key to achieving O(n) time complexity.
  • The initialization map.put(0,1) is crucial for accounting for subarrays that start at index 0.
  • The code is concise and easy to read, with clear variable names like rSum and cmp.

There are no significant issues to address. However, consider adding a comment to explain the purpose of the cmp variable (e.g., "the complement needed to form a subarray sum k") to make the code even more understandable. Also, while not necessary, you could add a brief comment above the loop to describe the algorithm.

Overall, great job! This solution is efficient and correct.

**

VERDICT: NEEDS_IMPROVEMENT


Contiguous Binary Subarray (Problem18.java)

Your solution is excellent and matches the reference implementation exactly. You have correctly implemented the algorithm with optimal time and space complexity. The code is clean, readable, and follows best practices. Here are some minor points to consider for future improvements, though they are not necessary in this case:

  • You might consider adding a brief comment explaining the purpose of initializing the map with (0, -1) to make the code more self-explanatory.
  • The variable name rSum is clear, but you could also use count or balance to make it more descriptive.
  • Ensure consistent formatting (e.g., space after if and before {), though your code is already well-formatted.

Overall, this is a perfect solution. Keep up the good work!

VERDICT: PASS


Longest Palindrome in a string (Problem19.java)

Remember, the student's solution might be in a different language than the reference, but the problem is the same. Evaluate the student's solution based on the problem requirements and the reference solution's approach.

Let's begin.

VERDICT: NEEDS_IMPROVEMENT

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