Solved


Magic is simple (for beginners)
Determine for a magic square of order n, the magic sum m. For example m=15 for a magic square of order 3.

14 days ago

Solved


Make a random, non-repeating vector.
This is a basic MATLAB operation. It is for instructional purposes. --- If you want to get a random permutation of integer...

14 days ago

Solved


Number of 1s in a binary string
Find the number of 1s in the given binary string. Example. If the input string is '1100101', the output is 4. If the input stri...

14 days ago

Solved


Minimal cost
A power house, P, is on one bank of a straight river W meters wide, and a factory, F, is on the opposite bank L meters downstrea...

14 days ago

Solved


Getting the indices from a vector
This is a basic MATLAB operation. It is for instructional purposes. --- You may already know how to find the logical indices o...

15 days ago

Solved


Function Iterator
Given a handle fh to a function which takes a scalar input and returns a scalar output and an integer n >= 1, return a handle f...

15 days ago

Solved


frame of the matrix
Given the matrix M, return M without the external frame.

15 days ago

Solved


Make a vector of prime numbers
Input(n) - length of vector with prime numbers Output(v) - vector of prime numbers Example: * n=1; v=2 * n=3; v=[2 3 5...

15 days ago

Solved


Project Euler: Problem 8, Find largest product in a large string of numbers
Find the greatest product of five consecutive digits in an n-digit number. 73167176531330624919225119674426574742355349194934...

15 days ago

Solved


Increment a number, given its digits
Take as input an array of digits (e.g. x = [1 2 3]) and output an array of digits that is that number "incremented" properly, (i...

15 days ago

Solved


Multiples of a Number in a Given Range
Given an integer factor _f_ and a range defined by _xlow_ and _xhigh_ inclusive, return a vector of the multiples of _f_ that fa...

15 days ago

Solved


Remove the small words from a list of words.
Your job is to tidy up a list of words that appear in a string. The words are separated by one or more spaces. Remove all words ...

15 days ago

Solved


Project Euler: Problem 3, Largest prime factor
The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number being input, input might be ui...

15 days ago

Solved


Determine if input is odd
Given the input n, return true if n is odd or false if n is even.

15 days ago

Solved


Project Euler: Problem 1, Multiples of 3 and 5
If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23...

15 days ago

Solved


Can we make a triangle?
Given three positive number, check whether a triangle can be made with these sides length or not. remember that in a triangle su...

15 days ago

Solved


Find all elements less than 0 or greater than 10 and replace them with NaN
Given an input vector x, find all elements of x less than 0 or greater than 10 and replace them with NaN. Example: Input ...

15 days ago

Solved


Find the sides of an isosceles triangle when given its area and height from its base to apex
Find the sides of an isosceles triangle when given its area and the height from its base to apex. For example, with A=12 and h=...

15 days ago

Solved


Column Removal
Remove the nth column from input matrix A and return the resulting matrix in output B. So if A = [1 2 3; 4 5 6]; ...

15 days ago

Solved


Back to basics 6 - Column Vector
Covering some basic topics I haven't seen elsewhere on Cody. Given an input vector, output true or false whether it is a colu...

15 days ago

Solved


Right Triangle Side Lengths (Inspired by Project Euler Problem 39)
If p is the perimeter of a right angle triangle with integral length sides, { a, b, c }, there are exactly three solutions for p...

15 days 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.

15 days ago

Solved


Calculate the area of a triangle between three points
Calculate the area of a triangle between three points: P1(X1,Y1) P2(X2,Y2) P3(X3,Y3) these three points are the vertices of ...

15 days ago

Solved


Max of a Vector
Write a function to return the max of a vector

15 days ago

Solved


Remove any row in which a NaN appears
Given the matrix A, return B in which all the rows that have one or more <http://www.mathworks.com/help/techdoc/ref/nan.html NaN...

15 days ago

Solved


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

15 days ago

Solved


Pizza!
Given a circular pizza with radius z and thickness a, return the pizza's volume. [ z is first input argument.] Non-scored bonus...

15 days ago

Solved


Rotate Matrix @180 degree
Rotate Matrix @180 degree Example A=[8 1 6; 3 5 7; 4 9 2], then answer would be [2 9 4;...

15 days ago

Solved


Find the max element of the array
Find the max element of the array

15 days ago

Solved


Square root
Given x (a matrix), give back another matrix, where all the elements are the square roots of x's elements.

15 days ago

Load more