How would you solve this 'interview' question in D?
Diggory
diggsey at googlemail.com
Wed Jun 26 16:05:53 PDT 2013
On Wednesday, 26 June 2013 at 22:43:05 UTC, David wrote:
> Am 26.06.2013 22:51, schrieb Gary Willoughby:
>> Just for a bit of fun, I saw this question posted on reddit
>> the other
>> day and wondered how *you* would solve this in D?
>>
>> http://stackoverflow.com/questions/731832/interview-question-ffn-n
>
> I solved it ;)
>
> http://dpaste.dzfl.pl/5cd56e9d
Let's keep it simple:
int f(uint n) { return n; }
uint f(int n) { return -n; }
More information about the Digitalmars-d-learn
mailing list