The solution I wrote was quite slow so it needs another algorithm.
The solution I wrote was quite slow so it needs another algorithm.