Created
November 14, 2019 20:16
-
-
Save fakedrake/7eedd6a72b298c18f8c077c67e94aea8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s1843530: | |
Based on your comment the solution seems on the right track but fillQueue is the important part. | |
s1869635: | |
The approach seems ok, break yor code in subroutines. | |
s1844752: | |
not much to comment on | |
s1840770: | |
Streams are consumed lazily, once you go throuh one (eg to | |
count the elements) it's gone unless you actively store the | |
elements. Also the point wasn't to find the shortest stream, | |
it was to merge the streams. | |
s1839679: | |
The code needs a bit polishing, the main problem is that you | |
call next instead of peek | |
s1865890: | |
Your code deduplicates and concatenates the streams. You | |
should have merged them. | |
s1900925: | |
Good, but elements come in sorted, you don't need to keep | |
track of all of them to deduplicate, only the last one. | |
s1870697: | |
Good | |
s1902147: | |
Your code is good, thanks for the joke | |
s1830962: | |
Good | |
s1871633: | |
No Solution | |
s2001696: | |
No solution | |
s1870157: | |
Correct | |
s1831673: | |
No solution | |
s1840235: | |
Note that Ltemp = self.L does not create a copy of | |
self.L. Modifying Ltemp will also modify self.L. Also python | |
does not support tail call elimination. | |
s1835399: | |
Correct | |
s1837803: | |
itemStreams will typically not fit in memory, they are to be | |
consumed lazily, ie don't store the entire stream and when | |
next() is called pop no more items than needed to come up | |
with the correct value | |
s1837246: | |
Correct | |
s1857644: | |
Good | |
s1831707: | |
No solution | |
s1864650: | |
Correct | |
s1857043: | |
Avoid storing all hits in a set, since the streams are | |
ordered you only need to compare to the latest one. | |
s1842093: | |
while (strem.peek() is not None): .. will spin forever since | |
x.peek() does not change it's value unless x.next() is called. | |
(incomplete code) | |
s1839825: | |
Don't store the entirely each stream in memory from the | |
start, consume them as little as possible at a time when | |
next() is called. | |
s1836369: | |
No solution | |
s1850160: | |
Good | |
s1849401: | |
Some potential minor issues like if an empty list of | |
itemStreams is provided your code will break but the approach | |
is in general correct. | |
s1847802: | |
Good | |
s1843021: | |
Good | |
s1869527: | |
Avoid storing all hits in a set, since the streams are | |
ordered you only need to compare to the latest one. You also | |
ignored the constraints imposed by lineWindow and minRequired | |
s1833978: | |
Returning will exit all loops. | |
s1848273: | |
No solution | |
s1839518: | |
No solution | |
s1846854: | |
No solution | |
s1865783: | |
Good | |
s1870794: | |
Good, note that when finding a minimum it is safer start with | |
a value outside of the domain or with the first value in the | |
sequence. | |
s1862671: | |
No solution | |
s1836526: | |
Good | |
s1863753: | |
Good | |
s1852056: | |
Seems ok, break your code into functions | |
s1863702: | |
Good | |
s1851202: | |
Good | |
s1848178: | |
Good, try to break your code into functions. | |
s1869672: | |
No solution |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment