Solved


Create a vector of n alternating ones and zeros (★★)
Given n, your output should be a vector y of numbers such that the first number is 1 and the numbers following it alternate betw...

1 year ago

Solved


Replicate elements in vectors (★★★)
(copy of Prob 867) Replicate each element of a row vector (with NaN) a constant number of times. Examples n=2, A=[1 2...

1 year ago

Solved


Stacking vectors into a matrix
Given a 4x1 vector a, and a 2x2 matrix b, create a matrix M in which the first 2 rows are each identical to a and the last two r...

1 year ago

Solved


Variance computation (★★★)
Given a vector x with several values, compute the variance, whose formula is given by: <<https://i.imgur.com/Wg95KBE.gif>> ...

1 year ago

Solved


Reindex a vector (★★)
(copy of Prob. 676) You are given two vectors of equal length. Vector N has numeric values (no Inf or NaN) while vector IDX h...

1 year ago

Solved


Column Removal (★★★)
(copy of prob 7) Remove the nth column from input matrix A and return the resulting matrix in output B. So if A = [1 2...

1 year ago

Solved


Vector raised to a power, element-wise (★)
Given a vector A and a number x, raise each element of the vector to the power of x. Thus, if A = [2 5 7 1] and x = 0.5, then ...

1 year ago

Solved


Variance computation (★)
Given a vector x with several values, compute the variance, whose formula is given by: <<https://i.imgur.com/Wg95KBE.gif>> ...

1 year ago

Solved


Create a vector of the first n odd numbers (★)
If n = 10, your program should return a vector y, where y = [1 3 5 7 9 11 13 15 17 19].

1 year ago

Solved


Average of corner elements of a matrix (★★)
(copy of prob 2235) Calculate the average of corner elements of a matrix. e.g. x=[1 2 3; 4 5 6; 7 8 9;] avg = (1+3+7+9)...

1 year ago

Solved


Doubling elements in a vector (★★)
(copy of prob. 1024) Given the vector A, return B in which all numbers in A are doubling. So for: A = [ 1 5 8 ] t...

1 year ago

Solved


Sum of elements of a vector (★★★)
Given any vector x = [x1, x2, x3, ... xn], compute the sum of its elements. Thus, if x = [ 1 3 -2 5 ], then the sum of its el...

1 year ago

Solved


Matrix convolution
A certain convolution step involves an elementwise multipication between two 3x3 matrices and taking the resulting sum of the el...

1 year ago

Solved


Create a vector of the first n natural numbers (★)
If n = 7, your program should return a vector y, where y = [1 2 3 4 5 6 7].

1 year ago

Solved


Convert Two Character String into a Binary Vector
Given a string "XOXXO" convert it into a binary vector. [1 0 1 1 0] Paul Berglund implemented an optimal method in <http://ww...

1 year ago

Solved


Evaluating continued fractions
Given row vector c=[c0 c1 c2 c3 ...] evaluate the continued fraction x=c0+1/(c1+1/(c2+1/(c3+...))) If c is a ...

1 year ago

Solved


Recursive triangle area
Given triangle 1 with sides of length a, b, and c. Triangle 2 is constructed within triangle 1 by bisecting each side. Triangl...

1 year ago

Solved


Find the largest sum of any contiguous subarray
Given an array of N integers, find the contiguous subarray (which must contain at least one number) with the maximum sum and ret...

1 year ago

Solved


Convert Kilometers to Miles
Convert kilometers to miles. Consider 1 km = 0.62 mile. Note: Don't use the '*' operator.

1 year ago

Solved


Sum the real and imaginary parts of a complex number
Sum the real and imaginary parts of a complex number. Example c = 1+2i has the solution 1 + 2 = 3

1 year ago

Solved


For a rectangle, if x is the length and 2x is width. Then find out x from the area of the rectangle?
For a rectangle, if x is the length and 2x is the width. Then find out x from the area of the rectangle? if the area is equal...

1 year ago

Solved


Pronounce digits
Given a number num, select the first d decimal places and pronounce the digits (in English). The function returns the pronunciat...

1 year ago

Solved


Get ranks of values in a vector
For a given vector, say [6 3 8 2], return the ranks (ascending) of observations, i.e. [3 2 4 1]. Do not worry about tied ranks. ...

1 year ago

Solved


Accurate Division
Given three integers x, y and d, return x/y (as a string) to d significant digits. Remove leading and trailing zeros. Example...

1 year ago

Solved


List the Moran numbers
The quotient of a Moran number and its digit sum is prime. For example, 117 and 481 are Moran numbers because 117/(1+1+7) is 13 ...

1 year ago

Solved


Valid Chess Moves
Using standard Algebraic notation ('' for a pawn), given previous move and a next move, output true if it is a valid move or fal...

1 year ago

Solved


Compress list
Given a non-empty list L of positif integers, compress the list so that only one occurrence is retained if two (or more) equal e...

1 year ago

Solved


Do you have the minimum age?

1 year ago

Load more