remove duplicates in a sorted array if duplicates are allowed at most twice (2 Solutions!!)

Published --