Comment

Comment by dusted

I'm wondering how you guys would optimize that code ?

My naive approach would be something like this:

const int numCountryIndicies = however many there are..;

const char* countries = "A1\0A2\0...";

return (cc < numCountryIndicies)?countries[cc*2]:"UNKNOWN";

parent dusted 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton