In a circular list of length n, where a1 is adjacent to a2, a2 is adjacent to a3, and an is adjacent to a1. Each operation can delete one number, after each deletion, if there exists adjacent equal numbers, one of them will be automaticlly deleted until there are no adjacent equal numbers in the list.
For example, consider a circular list [1, 2, 3, 2]. If we delete the number 3, one of the adjacent 2's will be automatically deleted, resulting in [1, 2]. If we then delete the number 2, the list becomes [1]. Finally 1 is deleted, and the operation number is 3, because automatically deletions are not included.
I would like to know the maximum and minimum number of operations required to delete all the elements in the circular list. What are the approaches or algorithms that can be used to solve this problem efficiently? Java code is better.