Created
December 16, 2019 19:29
-
-
Save goofballLogic/75364969767246e35e662d89dcdb5f7f to your computer and use it in GitHub Desktop.
This file contains 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
long[] Consume(long[] source, long quantity) | |
{ | |
var acc = 0L; | |
bool Accumulate(long x) | |
{ | |
if (acc > quantity) return false; | |
acc += x; | |
return true; | |
} | |
return source.SkipWhile(Accumulate).ToArray(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment