first code good design :
Good design gets TLE
Second one Bad Design :
This one got accepted
If one goes through my submitted solution history i submitted around 20 versions of similar solution only to get the one with no function call and bad code accepted ,there is no difference in both in terms of logic ,implementation or any other overhead
If anyone can tell why it happens it will be great