algorithm - Stepping through three or more numeric sequences -
suppose supplied 3 different streams of monotonically increasing numbers. know nothing them , might random. how you write python code watch first occurrence of 3 matching numbers?
i realise generalisation of 1 project euler (pe) problem. seems harder. if it's problem on pe or other such site please tell me won't expect answer. in advance.
pretty straightforward: assuming you're given 3 iterators, advance 1 has lowest current value. @ each advance, check new item against "current" values of rest. generalizes number of iterators, doesn't need memory beyond one-item-per-iter.
Comments
Post a Comment