Solved

N-Cards Problem

You have a deck of _N_ cards numbered in order from 1 to _N_. You discard the top card (card 1) and place the next card (card 2)...

presque 9 ans ago

Solved

Who is the smartest MATLAB programmer?

Who is the smartest MATLAB programmer? Examples: Input x = 'Is it Obama?' Output = 'Me!' Input x = 'Who ?' Ou...

presque 9 ans ago

Solved

Make an N-dimensional Multiplication Table

*INSTRUCTIONS* This is a multi-dimensional variant of the normal multiplication table used to teach elementary students multi...

presque 9 ans ago

Solved

Back to basics 2 - Function Path

Covering some basic topics I haven't seen elsewhere on Cody. Given a string that is the name of a MATLAB function, return a s...

presque 9 ans ago

Solved

Create a function handle that reverses the input arguments of another function handle

Given a function that takes two input arguments and returns one output, create another function handle that performs the same op...

presque 9 ans ago

Solved

Getting the absolute index from a matrix

This is a basic MATLAB operation. It is for instructional purposes. --- You may already know how to get the <http://www.ma...

presque 9 ans ago

Solved

Reverse the Words (not letters) of a String

*Description* Change the words of a string such that the words appear in reverse order. You may assume that the string is a n...

presque 9 ans ago

Solved

surrounded matrix

With a given matrix A (size m x n) create a matrix B (size m+2 x n+2) so that the matrix A is surrounded by ones: A = [1 2 ...

presque 9 ans ago

Solved

Reindex a vector

You are given two vectors of equal length. Vector N has numeric values (no Inf or NaN) while vector IDX has integers. Place th...

presque 9 ans ago

Solved

vectorization in N

For a given integer n (n>1), compute the sum f (i) (1 <= i <= n) where f (i) = 1 if n is odd and 2 otherwise.

presque 9 ans ago

Solved

Return unique values without sorting

If the input vector A is [42 1 1], the output value B must be the unique values [42 1] The *values of B are in the s...

presque 9 ans ago

Solved

Specific Element Count

Given a vector _v_ and a element _e_, return the number of occurrences of _e_ in _v_. Note: NaNs are equal and there may be n...

presque 9 ans ago

Solved

Back to basics 19 - character types

Covering some basic topics I haven't seen elsewhere on Cody. Return the number of punctuation characters in the input variabl...

presque 9 ans ago

Solved

Make an awesome ramp for a tiny motorcycle stuntman

Okay, given a vector, say v=[1 3 6 9 11], turn it into a matrix 'ramp' like so: m=[1 3 6 9 11; 3 6 9 11 0; 6 9 ...

presque 9 ans ago

Solved

sum of non-primes

The sum of the non-primes below 10 is 1+4+6+8+9+10=38 Find the sum of all the non-primes below the input, N.

presque 9 ans ago

Solved

Getting the row and column location from a matrix

This is a basic MATLAB operation. It is for instructional purposes. --- You may already know how to get <http://www.mathwo...

presque 9 ans ago

Solved

Number of Circles in a Number

Given a number, return the number of closed 'circles' in the base 10 numerical representation. Note: the number 4 has no circ...

presque 9 ans ago

Solved

Cannon Ball

Given g (acceleration due to gravity) and desired altitude x, find the minimum ground velocity of a cannon ball to reach x.

presque 9 ans ago

Solved

DC chopper

Input x is the sampled signal vector, may have both AC and DC components. output vector y should have AC components removed then...

presque 9 ans ago

Solved

Back to basics 16 - byte order

Covering some basic topics I haven't seen elsewhere on Cody. Switch the byte order of the input (i.e. if little-endian -> big...

presque 9 ans ago

Solved

Triangle Numbers Below N

This is an offshoot of <http://www.mathworks.com/matlabcentral/cody/problems/5-triangle-numbers Cody Problem 5: Triangle Numbers...

presque 9 ans ago

Solved

The Tower of Hanoi

In the <http://en.wikipedia.org/wiki/Tower_of_Hanoi Tower of Hanoi problem> with 3 rods (1, 2 & 3), the goal is to move a tower ...

presque 9 ans ago

Solved

Is this matrix orthogonal?

Given a square matrix, a, determine whether it is orthogonal. INPUT: a, a n x n matrix OUTPUT: true or false

presque 9 ans ago

Solved

Return the 'Size' of a String of Code

One of the most 'mysterious' parts of playing Cody is the sizing system. Given a string of commands, return the size that Cody w...

presque 9 ans ago

Solved

middleAsColumn: Return all but first and last element as a column vector

Given input A, return all but the first and last elements, arranged as a column vector. (I.e., all dimensions after the first s...

presque 9 ans ago

Solved

Duplicate each element of a vector.

for an n-dimensional vector x, the function should return another vector 2n-dimension which each element is repeated twice. Ex...

presque 9 ans ago

Solved

Determine if a Given Number is a Triangle Number

*Description:* Determine if the elements of an input array are triangle numbers and return the result as an array with the sa...

presque 9 ans ago

Solved

Hackathon: the beginnings

I am thinking of a number between 1 and 10000... can you guess what this number is? *Description* The test suite has rando...

presque 9 ans ago