tried CountChange Algorithm