HACKER Q&A
📣 lostmsu

Any compilers that can optimize (A plus B).max() to a single pass?


Any compilers that can optimize (A plus B).max() to a single pass?


  👤 floxy Accepted Answer ✓
Assuming "A" and "B" are collections of somesort, "plus" is concatenation/union, and "max" finds the maximum in the collection? If your collections were double-ended queues, concatenation would be a constant time operation, so you'd only have a single pass for "max".