Solved

Whether the input is vector?

Given the input x, return 1 if x is vector or else 0.

4 months ago

Solved

Reverse the vector

Reverse the vector elements. Example: Input x = [1,2,3,4,5,6,7,8,9] Output y = [9,8,7,6,5,4,3,2,1]

4 months ago

Solved

Generate a vector like 1,2,2,3,3,3,4,4,4,4

Generate a vector like 1,2,2,3,3,3,4,4,4,4 So if n = 3, then return [1 2 2 3 3 3] And if n = 5, then return [1 2 2 3 3 3 4...

4 months ago

Solved

Maximum value in a matrix

Find the maximum value in the given matrix. For example, if A = [1 2 3; 4 7 8; 0 9 1]; then the answer is 9.

4 months ago

Solved

Create an arrow matrix

An arrow matrix is a square matrix that contains ones on the diagonal, the last column, and last row. ...

4 months ago

Solved

Calculating Student Grades

The matrix grades contains raw grades for 7 students who took your course. Each row represents a different student. The first 7 ...

4 months ago

Solved

Determine if x is a combination of m and n

Given positive integers x, m, and n, determine if x can be written as x = am + bn for any (non-negative) integers a and b. Your ...

4 months ago

Solved

Dog Statistics

The vectors ht and wt contains the heights and weights of 20 golden retrievers. In some cases, it was not possible to make both ...

4 months ago

Solved

Generate this matrix

Generate the following matrix. n = 2; out = [-4 -3 -2 -1 0 -3 -2 -1 0 1 -...

4 months ago

Solved

Simpson's Paradox - Calculate correlation coefficients for groups of data

Simpson's Paradox is a statistical phenomenon where groups of data can have a characteristic while the whole data set together h...

4 months ago

Solved

Find the minimum of the column-maximums of a matrix

Given a matrix A, find the maximum value of each column, then return the smallest of those maximum values (ie return the minimum...

4 months ago

Solved

Calculate the mean of each half of a matrix

Given a matrix with an even number of columns, n, return a 1-by-2 row vector where the first element is the mean of all the elem...

4 months ago

Solved

Find Closest Constant

Given a number x, return the value that is closest to x from this list of constants: 0, 1, , e, , (also known as ). For exampl...

4 months ago

Solved

Matrix Quadrants

Write a function that takes N as the input, and outputs a matrix whose upper-left (NxN) quadrant contains all ones, the lower-ri...

4 months 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...

4 months ago

Solved

Get the length of a given vector

Given a vector x, the output y should equal the length of x.

4 months ago

Solved

Select every other element of a vector

Write a function which returns every other element of the vector passed in. That is, it returns the all odd-numbered elements, s...

4 months ago

Solved

Compound Interest: Present Value

Theorem : Compound Interest where, F : Future value at the end of n periods P : Present value r : Annual nominal rate n :...

4 months ago

Solved

QWERTY coordinates

Given a lowercase letter or a digit as input, return the row where that letter appears on a standard U.S. QWERTY keyboard and it...

4 months ago

Solved

Create times-tables

At one time or another, we all had to memorize boring times tables. 5 times 5 is 25. 5 times 6 is 30. 12 times 12 is way more th...

4 months ago

Solved

Finding Perfect Squares

Given a vector of numbers, return true if one of the numbers is a square of one of the numbers. Otherwise return false. Example...

4 months ago

Solved

Find state names that end with the letter A

Given a list of US states, remove all the states that end with the letter A. Example: Input s1 = 'Alabama Montana Nebras...

4 months ago

Solved

Interpolator

You have a two vectors, a and b. They are monotonic and the same length. Given a value, va, where va is between a(1) and a(end...

4 months ago

Solved

Make a checkerboard matrix

Given an integer n, make an n-by-n matrix made up of alternating ones and zeros as shown below. The a(1,1) should be 1. Examp...

4 months ago

Solved

Find the sum of all the numbers of the input vector

Find the sum of all the numbers of the input vector x. Examples: Input x = [1 2 3 5] Output y is 11 Input x ...

4 months ago