-
Notifications
You must be signed in to change notification settings - Fork 73
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
add Array::dedup_consecutive
for removing consecutive repeated elements in array
#1062
base: main
Are you sure you want to change the base?
Conversation
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Potential Issues in the Provided
|
Array::unique
for removing consecutive repeated elements in array
Pull Request Test Coverage Report for Build 3307Details
💛 - Coveralls |
92446a6
to
cb1a7af
Compare
Just my opinion: |
note the original
|
@bobzhang using
has roughtly the same behavior as the For example, for array
Additionally, using |
IMO neither of the two names are good for a function that removes consecutive repeated elements, I'm considering using a longer name (like |
f670ec2
to
d5565f3
Compare
Array::unique
for removing consecutive repeated elements in arrayArray::dedup_consecutive
for removing consecutive repeated elements in array
For backward compatibility, this PR updates the documentation for
Array::dedup
, so that it shall not break any existing code that use this function. This PR also add another function (Array::unique
) to implement the originally proposed functionality, i.e. de-duplication of consecutive repeated elements.cc @Demonmasterlqx
close #1061
Implementation in other programming language
unique
dedup
unique
unique
distinct
uniq
Data.List.Unique
See more on https://rosettacode.org/wiki/Remove_duplicate_elements
Algorithm Complexity
For the time-complexity of removing non-consecutive duplications:
quoted from https://rosettacode.org/wiki/Remove_duplicate_elements
Removing consecutive duplications should only require
Eq
trait and ofO(n)
time complexity.