Sort by

recency

|

1037 Discussions

|

  • + 0 comments

    Library fines can sometimes feel like a small but frustrating reminder of overdue responsibilities. It usually happens when a busy schedule makes you forget the return date, and suddenly you’re hit with a penalty. The idea behind fines is not just about money but also encouraging readers to share resources on time so others can enjoy them. In the same way, just as dubai painting contractors focus on precision and deadlines to deliver their work smoothly, returning books on schedule ensures the library runs efficiently. Many people now see these fines as a gentle push toward being more mindful. At the end of the day, it’s about valuing community resources and respecting shared spaces.

  • + 0 comments
    # Library Fine 🧾
    def library_fine(d1, m1, y1, d2, m2, y2):
        return (10000 if y1 > y2 else 
                (m1 - m2) * 500 if y1 == y2 and m1 > m2 else 
                (d1 - d2) * 15 if y1 == y2 and m1 == m2 and d1 > d2 else 
                0)
    
  • + 0 comments

    One JS Solution:

    function libraryFine(d1, m1, y1, d2, m2, y2) {
        if(y1 < y2 || ((y1 == y2) && (m1 < m2) || ((m1 == m2) && (d1 < d2)))) return 0
        if(y1 > y2) return 10000;      
        if(m1 > m2) return (m1 - m2)*500;
        return (d1 - d2)*15;
    }
    
  • + 0 comments

    Here is problem solution in Python, Java, C++, C and Javascript - https://programmingoneonone.com/hackerrank-library-fine-problem-solution.html

  • + 0 comments

    My simple Javascript solution

    function libraryFine(d1, m1, y1, d2, m2, y2) {

    return (y1 > y2) ? 10000:
     (y1 === y2 && m1 > m2)? (m1 - m2) * 500:
     (y1 === y2 && m1 === m2 && d1 > d2)?(d1 - d2) *15:
     0
    

    }