You are viewing a single comment's thread. Return to all comments →
This is my Java 8 solution, feel free to ask me any questions.
I don't recommend people using the implementation of the questions but, follow these steps to solve: 1. correct "or other line of code".
public static void updateLeapYear(int year) { if(year % 400 == 0) { //Origin month[2] = 29; //month[2] = 28; } else if(year % 100 == 0) {// month[2] = 28; //month[2] = 29; } else if(year % 4 == 0) { // month[2] = 29; // } else { // month[2] = 28; // } }
//Origin int x = d1; // x = x * 100 + m1; // x = x * 10000 + y1; //x = x * 1000 + y1;
Checking if the current date is lucky, increase result by 1.
//Origin // if(x % 4 == 0 && x % 7 == 0) { // result = result + 1; // } if(x % 4 == 0 || x % 7 == 0) { result = result + 1; }
Updating the current date to the next date.
if(d1 > month[m1]) { //Origin m1 = m1 + 1; // d1 = 1; // if(m1 > 12) { // y1 = y1 + 1; // m1 = 1; //m1 = m1 + 1; } // } //
Seems like cookies are disabled on this browser, please enable them to open this website
Prime Dates
You are viewing a single comment's thread. Return to all comments →
This is my Java 8 solution, feel free to ask me any questions.
I don't recommend people using the implementation of the questions but, follow these steps to solve:
1. correct "or other line of code".
Checking if the current date is lucky, increase result by 1.
Updating the current date to the next date.