Solved


Insert zeros into vector
Insert zeros after each elements in the vector. Number of zeros is specified as the input parameter. For example: x = [1 ...

nästan 5 år ago

Solved


Say something funny
Say something funny, or not. Your solution will be (fully automatically and objectively) scored based on how clever or funny ...

nästan 5 år ago

Solved


The Answer to Life, the Universe, and Everything
A variation of a previous Hitchhiker's Guide to the Galaxy problem. *Inputs:* Life, the Universe, and Everything *Output:*...

nästan 5 år ago

Solved


Return 'on' or 'off'
When the input is true, return 'on', otherwise, return 'off'.

nästan 5 år ago

Solved


Sum the Digits of a Number
Given an integer, sum the digits repeatedly until you end up with a single value less than 10. For example, if you add the di...

nästan 5 år ago

Solved


sum of non-primes
The sum of the non-primes no larger than 10 is 1+4+6+8+9+10=38 Find the sum of all the positive non-prime integers that do no...

nästan 5 år ago

Solved


I've got the power! (Inspired by Project Euler problem 29)
Consider all integer combinations of a^b and b^a for the integer values 2 ≤ a ≤ 4 and 2 ≤ b ≤ 5: 2^2=4, 2^3=8, 2^4=16,...

nästan 5 år ago

Solved


Test if two numbers have the same digits
Given two integers _x1_ and _x2_, return |true| if the numbers written with no leading zeros contain the same digits. That is, t...

nästan 5 år ago

Solved


Subtract two positive numbers
Given a and b as a string, return b-a without using string to number conversion functions. a and b must to be a same size and b ...

nästan 5 år ago

Solved


Add two numbers
Calculate the sum of two numbers. Example input = [2 3] output = 5

nästan 5 år ago

Solved


Pi Estimate 2
Estimate Pi as described in the following link: <http://www.people.virginia.edu/~teh1m/cody/Pi_estimation2.pdf>

nästan 5 år ago

Solved


"mirror" matrix
Create n x 2n "mirror" matrix of this type: Examples For n = 2 m = [ 1 2 2 1 1 2 2 1 ] For n = 3 m = ...

nästan 5 år ago

Solved


Number of Horns on a unicorn!
Calculate the number of horns on a *unicorn*! And I'm talking about a unicorn with not more than one horn on it!

nästan 5 år ago

Solved


First non-zero element in each column
For a given matrix, calculate the index of the first non-zero element in each column. Assuming a column with all elements zero ...

nästan 5 år ago

Solved


How to multiply?
* Imagine you are in 3012 Anno Domini, when everyone must learn how to multiply, * and competing for the highly prestigious pos...

nästan 5 år ago

Solved


Convert from Base 10 to base 5
Convert the input number from base 10 into base 5: for example: if a(in base 10)= 5 then a(in base 5)= 10

nästan 5 år ago

Solved


Arrange vector in ascending order
Arrange a given vector in ascending order. input = [4 5 1 2 9]; output = [1 2 4 5 9];

nästan 5 år ago

Solved


Rotate a Matrix by 90 degrees
Rotate a Matrix by 90 degrees Example: If the input is: X = 1 2 3 4 5 6 7 8 9 ...

nästan 5 år ago

Solved


Replace Vector Elements
Replace all elements in a vector which are equal to or smaller than zero with 0.1. Example: A = [1 2 3 -1 0 2 -3 -80]; ...

nästan 5 år ago

Solved


Convert a vector into a number
This is a sub problem related to this problem: <http://www.mathworks.com/matlabcentral/cody/problems/621-cryptomath-addition>...

nästan 5 år ago

Solved


Getting the row and column location from a matrix
This is a basic MATLAB operation. It is for instructional purposes. --- You may already know how to get <http://www.mathwo...

nästan 5 år ago

Solved


Tell me the slope
Tell me the slope, given a vector with horizontal run first and vertical rise next. Example input: x = [10 2];

nästan 5 år ago

Solved


Multiply a column by a row
* Given a column vector C and and a row vector R. * Output a matrix M. * Every column of M equals to C multiplied by correspon...

nästan 5 år ago

Solved


Rotate a Matrix
Input a Matrix x, Output y is the matrix rotating x 90 degrees clockwise

nästan 5 år ago

Solved


Compute a dot product of two vectors x and y
x and y are input vectors, d is a number and contains their dot product

nästan 5 år ago

Solved


Determine Whether an array is empty
Input a matrix x, output y is TRUE if x is empty, otherwise FALSE.

nästan 5 år ago

Solved


How to add?
* Imagine you are in 2222 Anno Domini, when everyone must learn how to add, * and competing for the highly prestigious post of,...

nästan 5 år ago

Solved


Return unique values without sorting
If the input vector A is [42 1 1], the output value B must be the unique values [42 1] The *values of B are in the s...

nästan 5 år ago

Solved


Back to basics 22 - Rotate a matrix
Covering some basic topics I haven't seen elsewhere on Cody. Rotate the input matrix 90 degrees counterclockwise (e.g. [1 2; ...

nästan 5 år ago

Solved


Sum of diagonal of a square matrix
If x = [1 2 4; 3 4 5; 5 6 7] then y should be the sum of the diagonals of the matrix y = 1 + 4 + 7 = 12

nästan 5 år ago

Load more