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 made several optimizations, my code worked within milliseconds for all year ranges between 1900 and 10^16, but could not understand why my testcases fails because of timelimit. Then I added checks for input data, and only got wrong answer result. Finally I started adding checks for every line, crashing app immediately if check failed and putting it into forever cycle otherwise, thus getting the only diagnostic info info this platform allowed me and found out that I read empty dates. Then I tried several approaches (reading line and trimming spaces) but they did not work, looks like there are not only spaces, but linebreaks as well.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #19: Counting Sundays
You are viewing a single comment's thread. Return to all comments →
I spent really enourmous time solving this one because of notorios test cases 3 and 4.
TLDR: use following snippet to read input values if you are using golang:
I made several optimizations, my code worked within milliseconds for all year ranges between 1900 and 10^16, but could not understand why my testcases fails because of timelimit. Then I added checks for input data, and only got wrong answer result. Finally I started adding checks for every line, crashing app immediately if check failed and putting it into forever cycle otherwise, thus getting the only diagnostic info info this platform allowed me and found out that I read empty dates. Then I tried several approaches (reading line and trimming spaces) but they did not work, looks like there are not only spaces, but linebreaks as well.