Union find with path compression (Java)

Dropdown ES6

Demo

Shifting Letters – Java O(n)