I think the issue is that the code should not work at all if the number of digits is more than N but mine still works. Am I correct with this assumption? I was trying to fix it but was looking at it for too long now. Need a fresh look and a hint, please.