If frequency of set is 0 , increment numberOfIslands
if c [ x ] == 0 : NEW_LINE INDENT numberOfIslands += 1 NEW_LINE c [ x ] += 1 NEW_LINE DEDENT else : NEW_LINE INDENT c [ x ] += 1 NEW_LINE DEDENT return numberOfIslands NEW_LINE