Is there a faster (or cleaner) algorithm for joining bubbles of water as shown below ?
I came up with this ugly code, which takes an arrayK of in
arrayK