We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I agree that it could be handled differently to avoid this all together in the real world. They could tweak it, but I think they did it this way to test to see if you can catch the subtle issue with AVG returning the data type that's passed in which resulted in the loss of precision and then knowing how to handle with that situation.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
The Blunder
You are viewing a single comment's thread. Return to all comments →
I agree that it could be handled differently to avoid this all together in the real world. They could tweak it, but I think they did it this way to test to see if you can catch the subtle issue with AVG returning the data type that's passed in which resulted in the loss of precision and then knowing how to handle with that situation.