Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
assignments
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
datovky
assignments
Commits
e0548e7f
Commit
e0548e7f
authored
6 years ago
by
Milan Straka
Browse files
Options
Downloads
Patches
Plain Diff
Explicitly show how to iterate over the data in the comment.
parent
87bbc071
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
11-find_duplicates/cpp/find_duplicates.h
+6
-2
6 additions, 2 deletions
11-find_duplicates/cpp/find_duplicates.h
11-find_duplicates/python/find_duplicates.py
+6
-3
6 additions, 3 deletions
11-find_duplicates/python/find_duplicates.py
with
12 additions
and
5 deletions
11-find_duplicates/cpp/find_duplicates.h
+
6
−
2
View file @
e0548e7f
...
...
@@ -5,8 +5,12 @@ vector<string> find_duplicates(DataGenerator& generator) {
* Find duplicates in the given data.
*
* The `generator` provides a forward iterator over strings
* for traversing the data (so it can be iterated for example
* using a `for` cycle). It can be traversed multiple times.
* for traversing the data, so it can be iterated for example
* using a `for` cycle:
*
* for (const string& item : generator) {...}
*
* The `generator` can be traversed multiple times.
*
* The goal is to return a vector of duplicated entries,
* reporting each duplicated entry only once, in the order
...
...
This diff is collapsed.
Click to expand it.
11-find_duplicates/python/find_duplicates.py
+
6
−
3
View file @
e0548e7f
...
...
@@ -4,9 +4,12 @@ import sys
def
find_duplicates
(
data_generator
):
"""
Find duplicates in the given data.
The data_generator is an `iterable` (it can be iterated over in a for cycle,
or passed to `iter` method to explicitly generate an iterator) returning
strings. It can be iterated multiple times.
The `data_generator` is an iterable over strings, so it can be
iterated for example using a `for` cycle:
for item in data_generator: ...
It can be iterated multiple times.
The goal is to return a list of duplicated entries, reporting each duplicated
entry only once, in the order of their first occurrence in the data.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment