DEV Community

Discussion on: Solution: Open the Lock

 
shamilmehdi profile image
Shamo

@thebarefootdev there is no rule that a function must have maximum of 10 lines of code. Yes we must keep them short, but not limited with exact line numbers. There are thousands of functions in modern libraries written by top companies which have more than 10 lines of code.

Also in competitive programming challenges your task is to solve the problem quickly. You are not developing a software library and don't have the obligation to make it scalable. So, in this solution functions are quite simple and they do one thing.

Having been studied or worked +20 years in software doesn't mean you do and tell right things. There are people reading your posts.