Determine validity after digit-constrained deletions | Google Interview Question