Cody

Problem 225. Subdivide the Segment

Solution 1104033

Submitted on 14 Jan 2017 by Peng Liu
• Size: 28
• 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
P1 = [1,8]; P2 = [0,5]; n_correct = 2; assert(isequal(divide_segment(P1,P2),n_correct))

2   Pass
P1 = [-807,541]; P2 = [-714,681]; n_correct = 41; assert(isequal(divide_segment(P1,P2),n_correct))

3   Pass
P1 = [1901,-1638]; P2 = [2046,-1472]; n_correct = 13; assert(isequal(divide_segment(P1,P2),n_correct))

4   Pass
P1 = [25631,-16475]; P2 = [26580,-15005]; n_correct = 29; assert(isequal(divide_segment(P1,P2),n_correct))

5   Pass
P1 = [1543,-188]; P2 = [2054,3250]; n_correct = 85; assert(isequal(divide_segment(P1,P2),n_correct))

6   Pass
P1 = [-26140,17799]; P2 = [11092,72482]; n_correct = 75149; assert(isequal(divide_segment(P1,P2),n_correct))

7   Pass
P1 = [81343,-182804]; P2 = [83042,-182048]; n_correct = 1789; assert(isequal(divide_segment(P1,P2),n_correct))

8   Pass
P1 = [418880,-37672]; P2 = [472348,556845]; n_correct = 356309290313; assert(isequal(divide_segment(P1,P2),n_correct))

Community Treasure Hunt

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

Start Hunting!