Hacker News new | ask | show | jobs
by akiselev 2731 days ago
I mean, in languages like Python it can be as simple as `foo[::-1]` or some similar method. Anyone who can give a naive answer like that or

    usize len = strlen(foo);
    char* bar = malloc(len);
    for (int i = 0; i < len; i++) {
        bar[i] = foo[len - (i + 1)];
    }
and explain why that won't work for unicode strings, I imagine, would pass that particular fizzbuzz test. Bonus points for pointing out the null byte off by one error.

The only competent programmers I can think of that wouldn't be able to come up with that off the top off my head work in embedded or FPGAs where strings are rarely relevant.