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.
functionprocessData(input){//Enter your code hereconst[returnDate,dueDate]=input.split("\n").map(d=>d.split(" ").map(s=>parseInt(s)))if((returnDate[0]<=dueDate[0]&&returnDate[1]<=dueDate[1]&&returnDate[2]<=dueDate[2])||returnDate[2]<dueDate[2]){returnconsole.log(0)}if(returnDate[0]>dueDate[0]&&returnDate[1]===dueDate[1]&&returnDate[2]<=dueDate[2]){returnconsole.log(15*(returnDate[0]-dueDate[0]))}if(returnDate[1]>dueDate[1]&&returnDate[2]===dueDate[2]){returnconsole.log(500*(returnDate[1]-dueDate[1]))}if(returnDate[2]>dueDate[2]){returnconsole.log(10000)}}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Day 26: Nested Logic
You are viewing a single comment's thread. Return to all comments →
My JavaScript solution;