7 kyu

The Coupon Code

23,146 of 31,243yaphi1

Description:

Story

Your online store likes to give out coupons for special occasions. Some customers try to cheat the system by entering invalid codes or using expired coupons.

Task

Your mission:
Write a function called checkCoupon which verifies that a coupon code is valid and not expired.

A coupon is no more valid on the day AFTER the expiration date. All dates will be passed as strings in this format: "MONTH DATE, YEAR".

Examples:

checkCoupon("123", "123", "July 9, 2015", "July 9, 2015")  ===  true
checkCoupon("123", "123", "July 9, 2015", "July 2, 2015")  ===  false
checkCoupon("123", "123", "July 9, 2015", "July 9, 2015")  ===  true
checkCoupon("123", "123", "July 9, 2015", "July 2, 2015")  ===  false
CheckCoupon("123", "123", "July 9, 2015", "July 9, 2015")  ==  true
CheckCoupon("123", "123", "July 9, 2015", "July 2, 2015")  ==  false
checkCoupon("123", "123", "July 9, 2015", "July 9, 2015")  == True
checkCoupon("123", "123", "July 9, 2015", "July 2, 2015")  == False
Date Time
Strings
Fundamentals

Stats:

CreatedJun 15, 2014
PublishedJun 15, 2014
Warriors Trained60268
Total Skips9115
Total Code Submissions242398
Total Times Completed31243
JavaScript Completions23146
C# Completions3524
TypeScript Completions1315
Python Completions3694
Total Stars589
% of votes with a positive feedback rating84% of 3395
Total "Very Satisfied" Votes2525
Total "Somewhat Satisfied" Votes640
Total "Not Satisfied" Votes230
Ad
Contributors
  • yaphi1 Avatar
  • jhoffner Avatar
  • acidghost Avatar
  • TehCupcakes Avatar
  • datagram Avatar
  • Blind4Basics Avatar
  • FArekkusu Avatar
  • hobovsky Avatar
  • ᛚᚨᚱᛊ ᚺᛖᚾᚱᛁᚲ Avatar
  • user8436785 Avatar
Ad