+ 2

Day of the Week Test Case #3 keeps failing, any suggestions?

https://code.sololearn.com/cXfFWbYzY3xh/?ref=app

15th Feb 2023, 1:36 AM
Javan Anderson
Javan Anderson - avatar
3 Respostas
+ 3
I know this is not too helpful, but I checked your solution and I think it's a good one, taking advantage of the Java time API. I would solve it in a similar way (I haven't tried yet). But I have no idea about the hidden case. It could be a bug in the task itself, but obviously we cannot confirm it. If others don't come up with a reasonable explanation, it might be worth reporting this to Sololearn so they double check on it.
15th Feb 2023, 5:01 AM
Tibor Santa
Tibor Santa - avatar
+ 3
Hello Javan, Firstly, the hidden test case #3 input is: January 1, 1990 The reason your code fails is that you are using 'dd' as the pattern. Both 'MM' and 'dd' require zero padding, so your code would work for dates 01, 02 etc but not 1, 2 etc. Easy fix, is to change ln17: .appendPattern("MMMM dd, yyyy") to: .appendPattern("MMMM d, yyyy") ps. nice work :D
15th Feb 2023, 6:09 PM
DavX
DavX - avatar
+ 3
Thank you so much DavX Much appreciated
15th Feb 2023, 6:17 PM
Javan Anderson
Javan Anderson - avatar