Skip to content

Completed Design 1 - #2694

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

Completed Design 1#2694
Keerthi0910 wants to merge 1 commit into
super30admin:masterfrom
Keerthi0910:master

Conversation

@Keerthi0910

Copy link
Copy Markdown

No description provided.

@super30admin

Copy link
Copy Markdown
Owner

Design HashSet (Hashset.java)

EURL@
data:

  • 'https://leetcode.com/problems/design-hashset/'
  • 'https://leetcode.com/problems/design-hashset/solution/'
  • 'https://booleanpirate.com/2018/04/hashset-implementation-in-java/'
  • Hashset.java
  • 'https://booleanpirate.com/2018/04/hashset-implementation-in-java/'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
    Hashset.java
  • 'https:// O'
  • 'https:// O'
  • 'httpsul O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'Hashset.java'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • "https:// O'"
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • ': O'
  • 'https:// O'
  • 'https:// O'
  • only O'
  • 'https:// O'
  • 'https:// O'
  • O
  • 'https:// O'
  • 'https:// O'
  • O
  • 'https:// O'
    meaningful O
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • '(https:// O'
  • 'https:// O'
  • 'https:// O'
  • O
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// MyHashSet'
  • 'https:// MyHashSet'
  • 'https:// MyHashSet'
  • 'https:// MyHashSet'
  • 'https:// MyHashSet'
  • 'https:// MyHashSet'
  • 'https:// MyHash edge O'
  • 'https:// MyHash edge O'
  • 'https:// MyHash edge O'
  • 'https:// MyHash edge O'
  • 'https:// MyHash edge O'
  • 'https:// MyHash edge O'
  • 'https:// MyHash edge O'
  • 'https:// MyHash edge O'
  • 'https:// MyHash edge O'
  • 'https:// MyHash edge O'
  • 'https:// MyHash edge O'
  • 'https:// MyHash edge O'
  • 'https:// MyHash edge O'
  • 'https:// MyHash edge O'
  • 'https:// MyHash edge O'
  • 'https:// MyHash edge O'
  • 'https:// MyHash edge O'
  • 'https:// Myul O'
  • 'https:// MyHash edge O'
  • 'https:// MyHash edge O'
  • 'https:// MyHash edge O'
  • 'https:// MyHash edge O'
  • 'https:// MyHash edge O'
  • 'https:// MyHash edge O'
  • 'https:// MyHash edge O'
  • 'https:// MyHash edge O'
  • 'https:// MyHash edge O'
  • 'https:// MyHash edge O'
  • 'https:// MyHash edge O'
  • 'https:// implementation O'
  • 'https:// implementation O'
  • 'https:// implementation O'
  • 'https:// implementation O'
  • 'https:// implementation O'
  • 'https:// implementation O'
  • 'https:// implementation O'
  • 'https:// implementation O'
  • 'https:// implementation O'
  • 'https:// implementation O'
  • 'https:// implementation O'
  • 'https:// implementation O'
  • 'https:// implementation O'
  • 'https:// implementation O'
  • 'https:// implementation O'
  • 'https:// implementation O'
  • 'https:// implementation O'
  • 'https:// implementation O'
  • 'https:// implementation O'
  • 'https:// implementation O'
  • 'https:// implementation O'
  • 'https:// implementation O'
  • 'https:// implementation O'
  • 'https:// implementation O'
  • 'https:// MyHashSet'
  • 'https:// MyHashSet'
  • 'https:// MyHashSet'
  • 'https:// MyHashSet'
  • 'https:// MyHash[][] storage'
  • 'https:// MyHash[][] storage'
  • 'https:// MyHash[][] storage'
  • 'https:// MyHash[][] storage'
  • 'https:// MyHash[][] storage'
  • 'https:// MyHash[][] storage'
  • 'https:// MyHash[][] storage'
  • 'https:// MyHash[][] storage'
  • 'https:// MyHash[][] storage'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • ' O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • O
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https:// O'
  • 'https://

VERDICT: NEEDS_IMPROVEMENT


Min Stack (MinStack.java)

Strengths:

  • Correct implementation of the two-stacks approach.
  • All operations are O(1) as required.
  • Good code organization and readability.
  • Helpful comments documenting time/space complexity.

Areas for improvement:

  • Consider using min directly in getMin() for consistency with how min is maintained throughout the class. Currently, min is updated in push() and pop(), but getMin() doesn't use it — instead it uses minStack.peek(). While both work, using min directly would be more consistent and slightly more efficient (avoiding a stack peek).
  • The sentinel value Integer.MAX_VALUE in minStack is a clever way to handle the initial state, but you could also just check if minStack is empty before peeking. Either approach is fine.

VERDICT: PASS

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.

3 participants