-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Open
Description
Bug Report for https://neetcode.io/problems/simplify-path
Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.
The first proposed solution has O(n^2) runtime due to the use of naive string concatenation e.g. cur += c. Don't forget that strings are immutable so naive concatenation is an O(n) operation and since this is within a for loop - that is O(n) - the overall solution becomes O(n^2). Therefore, the second solution should be strongly preferred!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels