Solved

Sum of the Multiplication of Vectors

Given the vectors x and y as input, multiply the vectors and return the summation of its elements. Example: x = [1 2 ...

1 year 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

1 year ago

Solved

Alternating sum

Given vector x, calculate the alternating sum y = x(1) - x(2) + x(3) - x(4) + ...

1 year ago

Solved

Replace multiples of 5 with NaN

It is required to replace all values in a vector that are multiples of 5 with NaN. Example: input: x = [1 2 5 12 10 7] ...

1 year ago

Solved

Replace every 3rd element in a vector with 4

x is a vector of undetermined length You are to replace every 3rd element with the number 4, example: x = [11 23 34 43 2 3...

1 year ago

Solved

Find the dimensions of a matrix

Just find the number of columns of the given matrix. Example x = [1 2 3 4 5 6] y = 2

1 year ago

Solved

Make one big string out of two smaller strings

If you have two small strings, like 'a' and 'b', return them put together like 'ab'. 'a' and 'b' => 'ab' For extra ...

1 year ago

Solved

Add two numbers

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

1 year ago

Solved

Determine Whether an array is empty

Input a matrix x, output y is TRUE if x is empty, otherwise FALSE.

1 year ago

Solved

Sorted highest to lowest?

Return 1 if the input is sorted from highest to lowest, 0 if not. Example: 1:7 -> 0 [7 5 2] -> 1

1 year ago

Solved

Is the input divisible by 3?

Return true if the input is divisible by 3 and false if not.

1 year ago

Solved

Find the hypotenuse

Given a and b (the two sides of a right-triangle), find c, the hypotenuse.

1 year ago

Solved

Divide by 4

Given the variable x as your input, divide it by four and put the result in y.

1 year ago

Solved

Create an index-powered vector

Given a input vector x, return y as index-powered vector as shown below. Example x = [2 3 6 9] then y should be [...

1 year ago

Solved

Create a vector whose elements depend on the previous element

The idea is to create a vector A whose elements depend on the previous element : *A(i+1) = 2*A(i)+1* *2 Inputs*: - A : The...

1 year ago

Solved

Find my daddy long leg (No 's')

Given the ratio of the two legs (longer / shorter), and the hypotenuse length, find the value of the bigger leg.

1 year ago

Solved

Solve a System of Linear Equations

*Example*: If a system of linear equations in _x₁_ and _x₂_ is: 2 _x₁_ + _x₂_ = 2 _x₁...

1 year 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]; ...

1 year ago

Solved

Return the Fibonacci Sequence

Write a code which returns the Fibonacci Sequence such that the largest value in the sequence is less than the input integer N. ...

1 year ago

Solved

Problem for beginners

Suppose that x is a column vector, with at least a length of 6. Delete the 2., 6., and the second last row. Example: X=[1;2;3...

1 year ago

Solved

Mid-term report

You just got your mid-term report, but it's full of ones and twos :(. So before you give it to your parents, you change it, in o...

1 year ago

Solved

Simple Matrix

Make the following matrix without typing it in one by one. [1 2 3; 2 4 6; 4 8 12] x=[1 2 3].

1 year ago