Akureyri*

Question

Solution

Idea

The general idea for this idea is relative easy. Basically, you just need to count how many times each unique location has appeared.

However, to implement it in C, it is a bit troublesome. I am not sure whether there will be a easier way to do that, but in my main function, attention should be paid on how to deal with memory allocation.

Here the general idea is as follows:

  1. If loc is not duplicate, then we only need to free name .

  2. Otherwise, we need to free name and loc .

Code

https://github.com/mendax1234/Coding-Problems/blob/main/kattis/akureyri/akureyri.c

Last updated