Sort by

recency

|

1559 Discussions

|

  • + 0 comments

    Here is Day of the Programmer solution in Python, Java, c++, c and javascript - https://programmingoneonone.com/hackerrank-day-of-the-programmer-problem-solution.html

  • + 0 comments

    c++ solution:

    string dayOfProgrammer(int year){ int day = 13; if (year < 1918) { if (year % 4 == 0) { day -= 1; } } else if (year == 1918) { day += 13; } else { if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)) { day -= 1; } } return to_string(day) + ".09." + to_string(year); } 
  • + 0 comments

    C++

    bool is_julian(int year) { return (year % 4 == 0); } bool is_gregorian(int year) { return (year % 4 == 0 && year % 100 != 0) || (year % 400 == 0); } string additional_zero(int n) { return (n < 10 ? "0" + to_string(n) : to_string(n)); } string dayOfProgrammer(int year) { vector<int> month_days = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int month = 0; int year_day = 256; if (year == 1918) { year_day += 13; } else if (year >= 1919) { if (is_gregorian(year)) { month_days[1] = 29; } } else { if (is_julian(year)) { month_days[1] = 29; } } while (year_day > month_days[month]) { year_day -= month_days[month]; month++; } month += 1; return additional_zero(year_day) + "." + additional_zero(month) + "." + to_string(year); } 
  • + 0 comments

    The Day of the Programmer celebrates innovation, problem-solving, and the continuous pursuit of knowledge — values that truly resonate with us at Ocentra Training Center. We believe in empowering learners with the technical and creative skills needed to thrive in the digital era.

  • + 0 comments

    in 1918, when the next day after January 31st was February 14th. This means that in 1918, February 14th (45th day) was the 32nd day of the year in Russia.

    It means we cut 13 days, that shifts the Day X to later date.