Can this approach be applied to any case of duplicate numbers?

Can this approach be used anywhere where we have to find a single unique element and all numbers repeat n times.
For example if n=2,then if I have to find single unique element it can be done using 2N+1 right ?

hey @sushant19_99, yes you can use this approach for other cases too