good for brain !
The best problem of the CUP challenge.
I think that thematic challenge is a wonderful idea. I solved this one with a great pleasure.
Great problem. So many ways to solve it. It was fun trying different methods to see which scored the best.
The connection of this problem with the Fibonacci sequence is most interesting.
Very interesting problem!
Good one :)
Combining the Fibonacci sequence and the Pythagorean theorem is a nice idea
I thought I had the right code and it didn't work. Then I realized that the area of the first triangle (n=1 case) should be 0.5*4*3 = 6. But is given in the solution as 25. Am I understanding this wrong? I thought the three sides of the first triangle (n=1) was 3,4,5 and we go on from there. Please let me know if my understanding is wrong and then I can proceed Otherwise I have a general code.
@ Dhaval: Try reading the last sentence of the problem very carefully.
@Milan Petrovic: Thank you, I completely missed that; silly me. Now I got it to work :)
Good problem. Kinda fun too.
Definitely needed to read that last line carefully. Like at least one other here, I misread it.
can someone help me with this problem?
tough but fun... had issues with assertion at first through
Does Cody not recognize the Fibonacci function?
Can anybody PLEASE send me the solution of this problem? My e-mail is: firstname.lastname@example.org
Nice one! Makes you think, and then the solution is simple and elegant.
It was a really great problem to solve. For me doing the steps as mentioned on paper helped a lot for proper visualization of the problem, and to understand the flow.
Thanks Tanya Morton for the problem exercise.
Very elegantly done!
Very very interesting problem. It introduces the importance of integer sequences.
Why I cannot use the matlab's fibonacci function here? It was Introduced in R2017a. My local PC's matlab and moble matlab can work it out well. Kind of strange.
@Jaya Lee: Cody does not support toolbox functions.
Interesting way to solve
function area = triangle_sequence(n)
area = y(n+2)^2;
Dear Cody Team,
solutions like mine shall be not allowed.
Elegant brain teaser and a good reminder to always read the question carefully...
And now, nobody will ever see it. You should have, at least, posted it.
Can you please delete this answer?
When I click on "leading solution", I get this solution, which is of no use.
Seems broken, when using Fibonacci ratio it won't work so I have botched it instead
So Exciting !
Finally made it :D ... Fibonacci sequence !
please help me out in understanding the problem
Didn't understand question
very hard example
R_T=[3 4 5];
R_T=[R_T(2) R_T(3) (R_T(2)^2+R_T(3)^2)^0.5]
Attention to the last line!
Double fibonacci sequence, subtle! I love this problem!
If anyone cares to point out why this is wrong, I'm open to hearing.
Note that the ratio of consecutive areas is asymptotically the golden ratio, i.e., phi=(1+sqrt(5))/2.
Weak! My recursion solution should work just fine, but the server is unable to evaluate it properly. I'm going to count it.
Its the best way that I found :)
I think it is the only way to solve this Problem. We Need to get the sides of nth triangle and ist done.
I consider my answer as a cheat
Yeah, you have just copied the required values of the test suits.
Interesting... (not a reflection on this particular solution but cody in general) - most of the lowest scored answers could be entries in an "obfuscated code" contest.
I'm curious how all these "Size 10" solutions look like. I don't get even close to this value. I terms of education, it would be great to see example codes which are able to go this low.
I join you @Eugen, it would be great to share some "Size 10" solutions samples.
yes, this is probably cheating
Who knows the last digit of pi?
Find the largest value in the 3D matrix
Change the sign of even index entries of the reversed vector
String Array Basics, Part 1: Convert Cell Array to String Array; No Missing Values
Is this triangle right-angled?
Area of an Isoceles Triangle
Dimensions of a rectangle
Side of a rhombus
Side of an equilateral triangle
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office