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's stupid. This was my original solution:
SELECT Ceiling(avg(salary) - Avg(Convert(numeric(20,5), Replace(salary, '0', '')))) from Employees
That returned 2252, which I believe is actually the correct answer. The average salary is 4046 and the avg without zeros is 1794.5.
4046 - 1794.5 = 2251.5
Rounded up is 2252. So this test is actually incorrect.
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 →
This is my solution for MsSQL:
I agree, that's stupid. This was my original solution:
That returned 2252, which I believe is actually the correct answer. The average salary is 4046 and the avg without zeros is 1794.5. 4046 - 1794.5 = 2251.5 Rounded up is 2252. So this test is actually incorrect.