-
Notifications
You must be signed in to change notification settings - Fork 50
EC Policer #3557
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
EC Policer #3557
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,3 +56,17 @@ func RepeatElement[E any, S []E](n int, e E) S { | |
| } | ||
| return s | ||
| } | ||
|
|
||
| // MaxLen returns max length in s. Returns 0 if s is empty. | ||
| func MaxLen(s []string) int { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I'm really worried about growing
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
at first I did so, and found it so inconvenient that I added
sure everybody remember https://go.dev/wiki/SliceTricks before |
||
| if len(s) == 0 { | ||
| return 0 | ||
| } | ||
| mx := len(s[0]) | ||
| for i := 1; i < len(s); i++ { | ||
| if len(s[i]) > mx { | ||
| mx = len(s[i]) | ||
| } | ||
| } | ||
| return mx | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when will it be done?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in a separate issue