(Translated by https://www.hiragana.jp/)
Convert an array to reduced form | Practice | GeeksforGeeks