Solved

longest sequence of nans

In an array return the length of longest sequence of nans for each column. x = [ 2 3 1 2 5 6; nan nan 5 n...

5 years ago

Solved

What is the next step in Conway's Life?

Given a matrix A that represents the state of <http://en.wikipedia.org/wiki/Conway's_Game_of_Life Conway's game of Life> at one ...

5 years ago

Solved

Joining Ranges

You are given a n-by-2 matrix. Each row represents a numeric range, e.g. x = [0 5; 10 3; 20 15; 16 19; 25 25] contains...

5 years ago

Solved

Generate a Parasitic Number

This problem is the next step up from <http://www.mathworks.com/matlabcentral/cody/problems/156-parasitic-numbers Problem 156>. ...

5 years ago

Solved

Genome decoding

Inspired by a question on the answer forum: You are given a matrix of 8-bit integers which encodes a genome. Each integer can...

5 years ago

Solved

Cat, Meowcat and Concatenation

Input is a cell array containing several strings. Find the largest continuous sub-string common to all strings. All strings are ...

5 years ago

Solved

Change Vector Value

Change the element of the vector with respect to the element of the direction vector If the element of the direction vecto...

5 years ago

Solved

nth Rational Number

Return the nth rational number. This is the inverse to Problem <http://www.mathworks.com/matlabcentral/cody/problems/1471 1...

5 years ago

Solved

Make a simplified barcode

Given an integer to encode, make a barcode using the following encoding scheme: * The bar code is made from the binary versio...

5 years ago

Solved

Polite numbers. N-th polite number.

A polite number is an integer that sums of at least two consecutive positive integers. For example _7 = 3+4_ so 7 is a polite...

5 years ago

Solved

Calculate the Damerau-Levenshtein distance between two strings.

<http://www.mathworks.co.uk/matlabcentral/cody/problems/2303-compute-hamming-distances-between-each-pair-of-rows-from-two-input-...

5 years ago

Solved

Calculate the Levenshtein distance between two strings

This problem description is lifted from <http://en.wikipedia.org/wiki/Levenshtein_distance>. The Levenshtein distance betwee...

5 years ago

Solved

Calculate the Hamming distance between two strings

Inspired by a similar Cody problem found <http://www.mathworks.com/matlabcentral/cody/problems/93-calculate-the-levenshtein-dist...

5 years ago

Solved

Find out the Gray Code for a Given Binary Number

Find out <http://en.wikipedia.org/wiki/Gray_code Gray Code> for a given binary number Example Binary input 1000 Gray ...

5 years ago

Solved

Bit calculation

Give me the count of numbers from 1 to n having their last two bits as 0. For example function y = ret_count(4) y = x...

5 years ago

Solved

Convert given decimal number to binary number.

Convert given decimal number to binary number. Example x=10, then answer must be 1010.

5 years ago

Solved

Relative ratio of "1" in binary number

Input(n) is positive integer number Output(r) is (number of "1" in binary input) / (number of bits). Example: * n=0; r=...

5 years ago

Solved

Binary

Given a positive, integer n, create a function that returns the respective binary number in the form of a vector. Example: ...

5 years ago

Solved

Do Fast Fourier Transformation

Example Fast Fourier Transformation from vector [2,1]) ans = 3 1

5 years ago

Solved

Compare two input matrices

Check which input matrix has more elements. Return "1" if matrix A has more elements than matrix B. Otherwise return "0". Exa...

5 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

5 years ago

Solved

Count ones

Write a program to count number of ones (1s) in an integer variable input. For example: Input x=2200112231 output y=3 I...

5 years ago

Solved

multiply by three

Given the variable x as your input, multiply it by 3 and put the result equal to y. Examples: Input x = 2 Output y is ...

5 years ago

Solved

Building matrices

If you have matrix A, create matrix B using matrix A as an "element" A = [1 2 3 4; 5 6 7 8...

5 years ago

Solved

Matlab Basics - Convert a row vector to a column vector

Write a script to convert a row (e.g. x = [1 2 3]) to a column (e.g. y = [1;2;3]), your script should be able to do this for any...

5 years ago

Solved

Given area find sides

In a right angle triangle given area 'A' one arm=x, another arm=2x then find the value of x. For example, area A=400 then ...

5 years ago

Solved

Find out missing number from a vector of 9 elements

You are given a vector of size 9, x = [x1 x2 x3 x4 x5 x6 x7 x8 x9] Elements of x may be randomly selected without repeati...

5 years ago

Solved

Divide by 4

Given the variable x as your input, divide it by four and put the result in y.

5 years ago

Solved

Add 7

Given an input variable x, output a variable y that is 7 greater than x. Example: Input x = 1 Output y is 8 Input ...

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

5 years ago