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.
- Prepare
- Algorithms
- Debugging
- Prime Dates
- Discussions
Prime Dates
Prime Dates
Sort by
recency
|
57 Discussions
|
Please Login in order to post a comment
what a waste of time. I am not here to test my knowledge on leap year cycles
There is definitely more than 5 things I want to change about this code xD. But indeed only 5 errors.
The output is equals to the expected result but HackerRank states that it is wrong. :(
Compiler Message Wrong Answer Input (stdin) 02-08-2025 04-09-2025 Your Output (stdout) 5 Expected Output 5
Here is my Java code:
How are we supposed to know the updateLeapYear function is wrong?
it works when you move from python 3 to pypy3
import re month = []
def updateLeapYear(year): if year % 400 == 0: month[2] = 29 elif year % 100 == 0: month[2] = 28 elif year % 4 == 0: month[2] = 29 else: month[2] = 28
def storeMonth(): month[1] = 31 month[2] = 28 month[3] = 31 month[4] = 30 month[5] = 31 month[6] = 30 month[7] = 31 month[8] = 31 month[9] = 30 month[10] = 31 month[11] = 30 month[12] = 31
def findPrimeDates(d1, m1, y1, d2, m2, y2): storeMonth() result = 0
for i in range(1, 15): month.append(31)
line = input() date = re.split('-| ', line) d1 = int(date[0]) m1 = int(date[1]) y1 = int(date[2]) d2 = int(date[3]) m2 = int(date[4]) y2 = int(date[5])
result = findPrimeDates(d1, m1, y1, d2, m2, y2) print(result)