Skip to content

complete design2#2469

Open
YogeshPardeshi wants to merge 2 commits into
super30admin:masterfrom
YogeshPardeshi:master
Open

complete design2#2469
YogeshPardeshi wants to merge 2 commits into
super30admin:masterfrom
YogeshPardeshi:master

Conversation

@YogeshPardeshi
Copy link
Copy Markdown

No description provided.

@super30admin
Copy link
Copy Markdown
Owner

Create Queue using Stacks (MyQueue.java)

Strengths:

  1. Clean implementation of the two-stack queue pattern
  2. Correct use of Stack class methods (push, pop, peek, isEmpty)
  3. Proper handling of empty queue edge case in pop()
  4. Good variable naming convention

Areas for Improvement:

  1. Consider adding input validation comments
  2. The pop() method could be slightly more efficient by checking empty() once and reusing the condition
  3. For production code, consider using Deque instead of Stack (Stack is legacy in Java)

Overall, this is a solid implementation that correctly solves the problem with appropriate time and space complexity.

VERDICT: PASS


Implement Hash Map

  • Strengths: The queue implementation is well-executed with proper handling of edge cases (empty queue returns -1 for pop). The code is clean and follows good practices.
  • Major Issue: This is the wrong problem entirely. You submitted a Queue implementation when the assignment was to implement a HashMap.
  • Recommendation: Please re-read the problem requirements and implement MyHashMap with put, get, and remove methods using a hash-based approach.

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