Cody

# Problem 2483. How long until the weekend?

Solution 3865493

Submitted on 26 Nov 2020 by Marek Macák
• Size: 10
• This is the leading solution.
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
% It's going to be a long week a = [2014 8 4 08 00 0]; weekend(a) b = 105; assert(abs(weekend(a)-b)<1e-5)

ans = 1

2   Pass
a = [2014 08 05 10 23 34]; weekend(a) b=78.607222; assert(abs(weekend(a)-b)<1e-5)

ans = 1

3   Pass
% Half way there a = [2014 08 06 13 39 15]; b = 51.3458333; assert(abs(weekend(a)-b)<1e-5)

4   Pass
a = [2014 08 07 23 12 41]; b = 17.788611; assert(abs(weekend(a)-b)<1e-5)

5   Pass
% Counting down the minutes a = [2014 08 08 16 31 59]; b = 0.466944; assert(abs(weekend(a)-b)<1e-5)

6   Pass
a = [2013 08 29 15 59 10]; b = 25.013888; assert(abs(weekend(a)-b)<1e-5)

7   Pass
a = [2013 12 30 09 05 9]; b = 103.914166; assert(abs(weekend(a)-b)<1e-5)

8   Pass
a = [2012 02 27 10 32 33]; b = 102.457500; assert(abs(weekend(a)-b)<1e-5)

9   Pass
% Prohibited functions. List may be added to if more cheats arise t=evalc('type weekend.m'); badwords={'str2num'}; assert(~any(cellfun(@(y) any(strfind(t,y)),badwords)));

### Community Treasure Hunt

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

Start Hunting!