Hi all,
I have a required which should satisfy all three conditions below
1. one or more 2 ---- keep only one 2, drop rest
Ex : 2,2,2,2 - > 2
2. one or more 3----keep only one 3, drop rest
Ex: 3,3,3,3 -> 3
3. one or more 2 + one or more 3 .....keep only 2, drop the rest
Ex : 2,2,3,3,3,3 -> 2.
Please help me in writing c # code which satisfies all above conditions.
Thank you.
What I have tried:
if (count of 2) > 1
retain first 2 and delete rest
if(count of 3) > 1
retain first 3 and delete rest
3rd condition?