How would you solve this 'interview' question in D?

Gary Willoughby dev at kalekold.net
Wed Jun 26 13:52:17 PDT 2013


The text from the question:

Design a function f, such that:

f(f(n)) == -n
Where n is a 32 bit signed integer; you can't use complex numbers
arithmetic.

If you can't design such a function for the whole range of
numbers, design it for the largest range possible.


More information about the Digitalmars-d-learn mailing list