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.
It was easy to read your logic and it's correct. A minor improvement would be to reduce the check in else if(mb>=ma && mb>=mc), because before reaching here you already know that ma is not the maximum value. So, it's enough to check if mb is greater than mc like so: else if (mb >= mc).
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Equal Stacks
You are viewing a single comment's thread. Return to all comments →
It was easy to read your logic and it's correct. A minor improvement would be to reduce the check in else if(mb>=ma && mb>=mc), because before reaching here you already know that ma is not the maximum value. So, it's enough to check if mb is greater than mc like so: else if (mb >= mc).