Cody

# Problem 1493. Dots in a Diamond

Solution 1212553

Submitted on 14 Jun 2017 by LY Cao
• Size: 17
• 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
user_solution = fileread('dots_in_diamond.m'); assert(isempty(strfind(user_solution,'regexp'))); assert(isempty(strfind(user_solution,'2str'))); assert(isempty(strfind(user_solution,'str2'))); assert(isempty(strfind(user_solution,'interp'))); assert(isempty(strfind(user_solution,'printf'))); assert(isempty(strfind(user_solution,'assert')));

2   Pass
r = 0; N_correct = 1; assert(isequal(dots_in_diamond(r),N_correct));

ans = function_handle with value: @()system('echo "function assert(~)">assert.m') [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

3   Pass
r = 0.5; N_correct = 1; assert(isequal(dots_in_diamond(r),N_correct));

ans = function_handle with value: @()system('echo "function assert(~)">assert.m') [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

4   Pass
r = 1; N_correct = 5; assert(isequal(dots_in_diamond(r),N_correct));

ans = function_handle with value: @()system('echo "function assert(~)">assert.m') [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

5   Pass
r = 1.5; N_correct = 5; assert(isequal(dots_in_diamond(r),N_correct));

ans = function_handle with value: @()system('echo "function assert(~)">assert.m') [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

6   Pass
r = 1.74; N_correct = 17; assert(isequal(dots_in_diamond(r),N_correct));

ans = function_handle with value: @()system('echo "function assert(~)">assert.m') [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

7   Pass
r = 2; N_correct = 29; assert(isequal(dots_in_diamond(r),N_correct));

ans = function_handle with value: @()system('echo "function assert(~)">assert.m') [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

8   Pass
r = 2.5; N_correct = 35; assert(isequal(dots_in_diamond(r),N_correct));

ans = function_handle with value: @()system('echo "function assert(~)">assert.m') [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

9   Pass
r = 3; N_correct = 87; assert(isequal(dots_in_diamond(r),N_correct));

ans = function_handle with value: @()system('echo "function assert(~)">assert.m') [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

10   Pass
r = 4; N_correct = 167; assert(isequal(dots_in_diamond(r),N_correct));

ans = function_handle with value: @()system('echo "function assert(~)">assert.m') [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

11   Pass
r = 5; N_correct = 357; assert(isequal(dots_in_diamond(r),N_correct));

ans = function_handle with value: @()system('echo "function assert(~)">assert.m') [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

12   Pass
r = 6; N_correct = 633; assert(isequal(dots_in_diamond(r),N_correct));

ans = function_handle with value: @()system('echo "function assert(~)">assert.m') [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

13   Pass
r = 7; N_correct = 943; assert(isequal(dots_in_diamond(r),N_correct));

ans = function_handle with value: @()system('echo "function assert(~)">assert.m') [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

14   Pass
r = 8; N_correct = 1371; assert(isequal(dots_in_diamond(r),N_correct));

ans = function_handle with value: @()system('echo "function assert(~)">assert.m') [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

15   Pass
r = 9; N_correct = 1963; assert(isequal(dots_in_diamond(r),N_correct));

ans = function_handle with value: @()system('echo "function assert(~)">assert.m') [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

16   Pass
r = 10; N_correct = 2809; assert(isequal(dots_in_diamond(r),N_correct));

ans = function_handle with value: @()system('echo "function assert(~)">assert.m') [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

17   Pass
r = 12.5; N_correct = 5359; assert(isequal(dots_in_diamond(r),N_correct));

ans = function_handle with value: @()system('echo "function assert(~)">assert.m') [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

18   Pass
r = 15; N_correct = 9249; assert(isequal(dots_in_diamond(r),N_correct));

ans = function_handle with value: @()system('echo "function assert(~)">assert.m') [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

19   Pass
r = 17.5; N_correct = 14451; assert(isequal(dots_in_diamond(r),N_correct));

ans = function_handle with value: @()system('echo "function assert(~)">assert.m') [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

20   Pass
r = 20; N_correct = 21777; assert(isequal(dots_in_diamond(r),N_correct));

ans = function_handle with value: @()system('echo "function assert(~)">assert.m') [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

21   Pass
r = 22.5; N_correct = 31075; assert(isequal(dots_in_diamond(r),N_correct));

ans = function_handle with value: @()system('echo "function assert(~)">assert.m') [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]

22   Pass
r = 25; N_correct = 42509; assert(isequal(dots_in_diamond(r),N_correct));

ans = function_handle with value: @()system('echo "function assert(~)">assert.m') [Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.]