Skip to content

Conversation

chhavibansal
Copy link
Contributor

Copy link
Owner

@ignacio-chiazzo ignacio-chiazzo left a comment

Choose a reason for hiding this comment

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

LGTM!

I'm curious if there is a solution with less order than O(n**2), but this is good to merge :)

Comment on lines 5 to 6
assert.equal(secondsToRemoveOccurrences("0110101"));
assert.equal(secondsToRemoveOccurrences("11100"))
Copy link
Owner

Choose a reason for hiding this comment

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

could you add the assert equals to a number?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i have added assertion, also i saw there was assertion missing for my last PR added that change as well.

also this is O ( N ) solution

Copy link
Owner

Choose a reason for hiding this comment

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

The replaceAll would have to iterate over the whole string, and the while(true) iterates over it too (it is not fixed 🤔 ).

@ignacio-chiazzo
Copy link
Owner

Thank you!

@ignacio-chiazzo ignacio-chiazzo merged commit 9c44dd2 into ignacio-chiazzo:master Oct 5, 2022
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