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.
No point of using toString method if you are calling System.out.println(stack.peek().curMax); for case 3;
if you really want to make use of the to string method then a bit of modification is needed.
publicStringtoString(){returncurMax+"";}
now call
System.out.println(stack.peek()); for case 3.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Maximum Element
You are viewing a single comment's thread. Return to all comments →
No point of using toString method if you are calling System.out.println(stack.peek().curMax); for case 3; if you really want to make use of the to string method then a bit of modification is needed.
now call System.out.println(stack.peek()); for case 3.