Cody

Problem 2639. How Many Months Until It's Today Again?

Solution 3466358

Submitted on 29 Oct 2020 by Mehmet OZC
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
d_in = '22-Oct-2014'; m_correct = 6; m_test = monthsUntilMatch(d_in); assert(isequal(m_test,m_correct))

thatweekday = 7 thatweekday = 2 thatweekday = 5 thatweekday = 1 thatweekday = 1 thatweekday = 4

2   Pass
d_in = '2-Jul-2014'; m_correct = 14; m_test = monthsUntilMatch(d_in); assert(isequal(m_test,m_correct))

thatweekday = 7 thatweekday = 3 thatweekday = 5 thatweekday = 1 thatweekday = 3 thatweekday = 6 thatweekday = 2 thatweekday = 2 thatweekday = 5 thatweekday = 7 thatweekday = 3 thatweekday = 5 thatweekday = 1 thatweekday = 4

3   Pass
d_in = '12-May-2011'; m_correct = 8; m_test = monthsUntilMatch(d_in); assert(isequal(m_test,m_correct))

thatweekday = 1 thatweekday = 3 thatweekday = 6 thatweekday = 2 thatweekday = 4 thatweekday = 7 thatweekday = 2 thatweekday = 5

4   Pass
d_in = '14-Jul-1789'; m_correct = 14; m_test = monthsUntilMatch(d_in) assert(isequal(m_test,m_correct))

thatweekday = 6 thatweekday = 2 thatweekday = 4 thatweekday = 7 thatweekday = 2 thatweekday = 5 thatweekday = 1 thatweekday = 1 thatweekday = 4 thatweekday = 6 thatweekday = 2 thatweekday = 4 thatweekday = 7 thatweekday = 3 m_test = 14

5   Pass
d_in = '31-Dec-1999'; m_correct = 3; m_test = monthsUntilMatch(d_in) assert(isequal(m_test,m_correct))

thatweekday = 2 thatweekday = 3 thatweekday = 6 m_test = 3

Suggested Problems

More from this Author50

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!