Check if sorted
Check if sorted.
Example:
Input x = [1 2 0]
Output y is 0
nästan 13 år ago
Solved
Summing digits
Given n, find the sum of the digits that make up 2^n.
Example:
Input n = 7
Output b = 11
since 2^7 = 128, and 1 + ...
nästan 13 år ago
Solved
Return the 3n+1 sequence for n
A Collatz sequence is the sequence where, for a given number n, the next number in the sequence is either n/2 if the number is e...
Swap the first and last columns
Flip the outermost columns of matrix A, so that the first column becomes the last and the last column becomes the first. All oth...
nästan 13 år ago
Solved
Fibonacci sequence
Calculate the nth Fibonacci number.
Given n, return f where f = fib(n) and f(1) = 1, f(2) = 1, f(3) = 2, ...
Examples:
Inpu...
nästan 13 år ago
Solved
Column Removal
Remove the nth column from input matrix A and return the resulting matrix in output B.
So if
A = [1 2 3; 4 5 6];
and ...