4
public static int findPar(int u) {5
return par[u] == u ? u : (par[u] = findPar(par[u]));8
public boolean equationsPossible(String[] equations) {10
for (int i = 0; i < 26; i++) {14
/*First perform all the merging operation*/15
for (String s : equations) {16
int c1 = s.charAt(0) - 'a';17
int c2 = s.charAt(3) - 'a';18
char sign = s.charAt(1);34
/*Now traverse on the whole string and search for any != operation and check if there parents are same*/35
for (String s : equations) {36
int c1 = s.charAt(0) - 'a';37
int c2 = s.charAt(3) - 'a';38
char sign = s.charAt(1);