Solved

LIFO Validation

Write a function to check whether a LIFO (Last In First Out) restriction on inventory is violated. We have two input vectors ...

7 years ago

Solved

Another colon problem

This is simple problem based on problems 555, 801, 1118, etc. Create an index vector from two input vectors. Example: ...

7 years ago

Solved

Derivative of polynomial

Compute the derivative of a given polynomial. The input is an <http://www.mathworks.com/help/matlab/math/representing-polynomial...

7 years ago

Solved

How unique?

Sometimes, when we check unique entries of vector we would like to know how many times each value occurs. Given vector of num...

7 years ago

Solved

"Low : High - Low : High - Turn around " -- Create a subindices vector

Let two vectors *lo* and *hi* be given. The job is to create a index vector like so idx = [lo(1):hi(1) lo(2):hi(2) ...]...

7 years ago

Solved

Number Persistence

A number's persistence is the number of steps required to reduce it to a single digit by multiplying all its digits to obtain a ...

7 years ago

Solved

Convert a numerical matrix into a cell array of strings

Given a numerical matrix, output a *cell array of string*. For example: if input = 1:3 output is {'1','2','3'} whic...

7 years ago

Solved

Back to basics 24 - Symbolic variables

Covering some basic topics I haven't seen elsewhere on Cody. Given a string algebraic expression, return the symbolic variabl...

7 years ago

Solved

Remove white space from the string

Remove the white spaces (trailing and leading) from the input variable

7 years ago

Solved

Back to basics 25 - Valid variable names

Covering some basic topics I haven't seen elsewhere on Cody. Given a string, return true if it is a valid MATLAB variable nam...

7 years ago

Solved

Additive persistence

Inspired by Problem 2008 created by Ziko. In mathematics, the persistence of a number is the *number of times* one must apply...

7 years ago

Solved

The prisoner

"We want information, information, information." "Who are you?" Input can be a string or a number (array).

7 years ago

Solved

Diagonal & Anti-Diagonal Matrix: Easy

Create a matrix as shown below from "magic" square. For example: if input x=9;then use mgic(x) and create the matrix...

7 years ago

Solved

Prime Time

All you need to do here is submit your solution a prime number of seconds after the top of the hour. Any hour at all... Easy, ...

7 years ago

Solved

Split a string into chunks of specified length

Given a string and a vector of integers, break the string into chunks whose lengths are given by the elements of the vector. Ex...

7 years ago

Solved

CONVERT TAN TO SIN

In a right angle triangle ABC given the tan(A) then find sin(A) For example tan(A)=3/4 then sin(A)=3/5

7 years ago

Solved

Dice face matrix!

This is dice simulator, but instead of making a random die number, you will receive an "pre-rolled" number in and spit out a mat...

7 years ago

Solved

convert?

* Given a string containing a number followed by pounds or kgs, for example: * 'Billy lost 22 pounds in four weeks.' * 'Maria ...

7 years ago

Solved

Numeric array to cell array of strings (easy)

Given a numeric array (A) and a 1xk cell array of strings (C), return a cell array (B) that is the same size as A and in which e...

7 years ago

Solved

COUNT VOWEL

Count, how many times vowels occurred. EXAMPLE: x='string the MaTLaBiAn' then the answer will be 6. x='coUnt the vowEl' th...

7 years ago

Solved

Generate a string like abbcccddddeeeee

This is the string version of Problem 1035. <http://www.mathworks.com/matlabcentral/cody/problems/1035-generate-a-vector-like-1-...

7 years ago

Solved

Mode

Find the mode of the vector Assumption: no vector is bimodal Example 1: input=[1 2 3 4 4]; output=4 Example 2: input=[7...

7 years ago

Solved

Find the position of first minimum value in an integer array with numbers

If x = [2 6 4 9 10 3 1 5 1] the the output should be 7, because the first minimum value (1) lies at the 7th position.

7 years ago

Solved

COUNT VOWEL 2

The objective of this problem is to determine the number of unique vowels used in the given string. Now count vowels in STRI...

7 years 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...

7 years ago

Solved

Find out the best cricketer

Irrespective of input, return Sachin Tendulkar as a output

7 years ago

Solved

Number of odd and even elements within matrix

Input(m) - any matrix with integers Output(n) - n(1)=number of odd elements, n(2)=number of even elements Example: * m=...

7 years ago

Solved

Determine if input is a Narcissistic number

<http://en.wikipedia.org/wiki/Narcissistic_number Narcissistic number> is a number that is the sum of its own digits each raised...

7 years ago

Solved

How many days does the cat take to climb out of the hole?

A cat accidentally falls down a hole with sloping but rough sides. It can climb out of the hole of height h metres, but for ever...

7 years ago