Solved


Recursion - Fun
Generate the first k terms in the sequence a(n) define recursively by a(n+1)=p*a(n)+(1+a(n)) with p=0.9 and a(1)=0.5 ...

6 years ago

Solved


Juggler sequence revisited
This problem is related to <http://www.mathworks.com/matlabcentral/cody/problems/42835-return-the-sequence-element-ii Problem 42...

6 years ago

Solved


Increasing sub-sequence (Level 1)
Given a vector, v, of real numbers, return a positive integer, n, representing the longest contiguous increasing sub-sequence co...

6 years ago

Solved


Find the gcm of n given values
Create a function that given n integer values greater than zero, finds the two numbers with the greatest common divisor and retu...

6 years ago

Solved


center of mass
R is a given matrix with size [n,2]. R(i,:) is interpreted as the 2D-position of a mass point with mass i. Calculate the center ...

6 years ago

Solved


Find longest run
Write a function longest_run that takes as input an array of 0's and 1's and outputs the length and index of the longest consecu...

6 years ago

Solved


Addition Partition
You will be given two numbers, N and K. Write a MATLAB function that will determine how many different unique ways you can have...

6 years ago

Solved


Block average ignoring NaN values
Given a matrix, calculate the block average of each disjoint sub-matrix while ignoring *NaN* values. Assume that the size of the...

6 years ago

Solved


Block average
Given a matrix, calculate the block average of each disjoint sub-matrix of the same size. Assume that the size of the matrix alo...

6 years ago

Solved


Free-time Equation
Given a 7-day week, an *_nc_* -number of *_tc_* -hour classes, *_ta_* -hours awake in a day, and *_tw_* -hours that you work in ...

6 years ago

Solved


Project Euler: Problem 18, Maximum path sum I
By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bott...

6 years ago

Solved


Outer product of multiple vectors
In tensor algebra, it is often useful to define a tensor as a product of lower order tensors. Similarly, a multidimensional arra...

6 years ago

Solved


Combined Ages 4 - Non-symmetric with multiples, n ≥ 3
This problem is slightly more difficult than <http://www.mathworks.com/matlabcentral/cody/problems/42383-combined-ages-3-non-sym...

6 years ago

Solved


Combined Ages 3 - Non-symmetric, n ≥ 3
Pursuant to the previous two problems ( <http://www.mathworks.com/matlabcentral/cody/problems/42382-combined-ages-1-symmetric-n-...

6 years ago

Solved


Determine if input is a valid AHP evaluation matrix
Input is a matrix. Output is a true or false statement (1 or 0). Return true if input is a valid Analytic Hierarchy Process eval...

6 years ago

Solved


Number construction I
Given a positive integer, n, return a, b, c and d, such that 1. n = a*sqrt(b)+c*sqrt(d) 2. a, b, c and d are all positive ...

6 years ago

Solved


Sorting integers by their digits (Level 3)
This is the next step up from <http://www.mathworks.com/matlabcentral/cody/problems/42811-sorting-integers-by-their-digits-level...

6 years ago

Solved


Sorting integers by their digits (Level 2)
This is the next step up from <http://www.mathworks.com/matlabcentral/cody/problems/42809-sorting-integers-by-their-digits Probl...

6 years ago

Solved


Sorting integers by their digits (Level 1)
Given a vector, v, of positive integers, return a vector, w, by sorting v in ascending order, such that primary sorting is done ...

6 years ago

Solved


How Far Can You Throw Something?
As you probably learned in your high school physics class, throwing an object at a 45 degree angle will give you the maximum ran...

6 years ago

Solved


Vector multiplication
Given two row vectors, v1 and v2, each representing an integer, such that the vector elements are the digits from left to right,...

6 years ago

Solved


Find unique number in input
Find value that occurs in odd number of input elements.

6 years ago

Solved


Piecewise linear interpolation
Given an Mx2 vector and a row of M-1 integers, output a two column vector that linearly interpolates Y times between each succes...

6 years ago

Solved


Remove collinear points in a set of 2D points defining a polygon
Consider a polygon that is obtained by joining a set of 2D points whose coordinates are stored in matrix P=[x,y]. Write a functi...

6 years ago

Solved


Simple polynomial evaluation
Compute the value of a polynomial of degree n with all coefficients '1', at value x. n is always n>=0. p(x)=1+x+x^2+...+x^n...

6 years ago

Solved


Polynomial evaluation
Compute the value of a polynomial of degree n with coeffcients in vector a, at value x. p(x)=a(1)+a(2)x+a(3)x^2+...+a(n+1)x...

6 years ago

Solved


solve for y that is half as much as three less than one tenth of x
function y = half(x) y = (x * .1); end

6 years ago

Solved


Iterative sum of digits of 2^n number
Given n, calculate the number 2^n (where n>=0) and *iterate* until the sum of the digits is a single-digit number. Example: ...

6 years ago

Solved


Split bread like the Pharaohs - Egyptian fractions and greedy algorithm
How would you split 5 loaves of bread among 8 people in all fairness? Get a hint from the Pharaohs. 5/8 = 4/8 + 1/8 , i.e. each ...

6 years ago

Solved


Maximum of ND-array
Find the maximum element of a N dimensional array. Example: A=[1 2 4 ; -20 4 10]; The maximum is 10.

6 years ago

Load more