Skip to content

Solution #1358 - Mridul/Edited - 11/03/2025 #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mrid88
Copy link
Member

@mrid88 mrid88 commented Mar 11, 2025

added solution.java and explanation.md with the time and space complexities

@JRS296 JRS296 self-requested a review March 17, 2025 12:44
Comment on lines +6 to +7
## Code Breakdown

Copy link
Member

Choose a reason for hiding this comment

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

Uh where's the code breakdown

Comment on lines +13 to +14
Time complexity: O(n)
Space complexity: O(n)
Copy link
Member

Choose a reason for hiding this comment

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

Kindly explain the Time & Space Complexity as well

freq.put(s.charAt(i), freq.getOrDefault(s.charAt(i), 0) + 1);

while (freq.size() == 3) {
cnt += s.length() - i;
Copy link
Member

Choose a reason for hiding this comment

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

Try to use a more meaningful variable name. This is fine here, but it would be better to call it count rather than cnt. It's a small pointer and can be ignored

Copy link
Member

@JRS296 JRS296 left a comment

Choose a reason for hiding this comment

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

Kindly make the required changes

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