Stack Exchange network consists of 183 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
unnecessary to call unordered_set::find(), since the information's available in second of the pair returned from insert(). no_dups &= v_abs.insert(x).second;
Toby's version using concat/join is correct (in regard to the bug mentioned above), because it doesn't require min or max to exist for individual vectors.
The specification is valid if the total number of elements across all three vectors is at least one, but your implementation only works if all three vectors are individually non-empty. So I'd argue that it is too early to discuss expressive/concise/performant, because it is not correct.
@AdrianMcCarthy: It's a bug in the specification, the description "Convert a non-negative integer" conflicts with the stated constraint "num is strictly greater than zero"
"English numerals are never written out in Title Case"? They are when found in titles. "Twenty Thousand Leagues Under the Seas" So it may make sense to have an option argument as_title_case rather than assert it is wrong.
@TomTsagkatos: Yes they are. The linker may or may not be able to deduplicate them during an optimization pass (for example, Microsoft's linker does this with OPT:ICF but it is non-compliant to rules about comparison of function pointers).
@lhballoti: Why in the world would you do that? This datatype is plenty small enough to pass by value efficiently, stack allocation is much more efficient than heap, and one will very often want to define arrays with memory locality, not arrays of pointers into the heap.
Your mention of two's-complement seems totally immaterial, there are no operations here which fail on other representations (except the one that fails on all representations).
Forcing an in-range value of INT_MIN to take the overflow early return path is a bit of trickery worthy of a comment and explanation in the answer prose.
In the larger context, magic might be guaranteed NUL-terminated, but that's essentially an implementation detail of the chosen I/O function. Other I/O functions don't make that guarantee, and the condition you're rewriting didn't depend on it. So I don't consider it equivalent. Could use strncmp to preserve the original semantics.