For some reason, I keep getting test suite errors:
L 3 (C 29-33): Invalid syntax at 'error'. Possibly, a ), }, or ] is missing. L 3 (C 29-33): Invalid syntax at 'error'. Possibly, a ), }, or ] is missing.
Hi M.C., in this problem some of the functions are banned by author. This cause "standard" solutions known from previous fibonacci numbers related problems to fail. Examine your code against functions and operators listed in 1st test.
Thanks Jan. I would have expected to receive the message "No fancy functions!" if was using something I shouldn't be. Here is my solution (which works in my matlab and doesn't appear to have anything "illegal"):
function y = fib(x)
[v,d] = eig([1 1; 1 0]);
M = v*bsxfun(@times, [d(1,1).^(x-1);d(2,2).^(x-1)], v\[1;1]);
y = uint8(M(2,:));
Ok, I see - I'm not allowed to use ^. The list of banned functions seems much more restrictive than not using a for or a conditional. Back to the drawing board!
Can Cody not handle nested functions?
Not sure why this solution is not working. It runs and works when I run it on my matlab.
Determine whether a vector is monotonically increasing
Clean the List of Names
Indexed Probability Table
Back to basics 15 - classes
Determine if input is a Narcissistic number
Return fibonacci sequence do not use loop and condition
Generate a vector like 1,2,2,3,3,3,4,4,4,4
Put m balls into n boxes (again)
Project Euler: Problem 14 Longest Collatz sequence(harder version)
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