Information and computing science student in China. I started playing Cody on 27th February 2018. MATLAB is my favorite tool in learning.

Solved

Mean number of letters per word (Easy)

Given a character array, s, representing a sentence, return a, the arithmetic mean of the number of letters per word in the give...

11 months ago

Solved

Reverse the Matrix

Given a Matrix A, reverse it. Such that, last element of A becomes 1st and vice versa. for example: Input = [1 2 3;4 5 ...

1 year ago

Solved

You never ask a lady her age

Instead you ask her to multiply her age by 10, then subtract any of the first nine multiples of 9 (9,18,...,81), and tell you th...

1 year ago

Solved

Solve The Equation

The coefficients of a system of equations are given in two vectors, x1 and x2. Write a function to solve the equation and return...

1 year ago

Solved

Return all matrix elements except elements on diagonal

Consider a given Matrix A=[a b c; d e f; g h i] then return a row vector T such that it contains all the El...

1 year ago

Solved

Project Euler: Problem 4, Palindromic numbers

A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 ...

1 year 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...

1 year ago

Solved

Get the combinations

Consider p,q = 2 vectors of same or different length. Get a Output Array which has all the possible combinations of Elements o...

1 year ago

Solved

Transpose the Matrix

Transpose the given matrix, e.g. x=[a b;c d] transpose of x = [a c;b d]

1 year ago

Solved

Find the Pattern

Find the pattern between input and output. Write a function that gives the correct output for any input. *Hint: magic*

1 year ago

Solved

Pass the Threshold!!

Write a Matlab function that will take as input a matrix of arbitrary dimensions and a scalar threshold value, and return a vec...

1 year ago

Solved

Find argmax of a function

You are given vectors x and y (=f(x)). Return the element of x for which f(x) is maximized.

1 year ago

Solved

The Google Interview: Two Eggs Problem

Consider the following problem, a popular Google interview question: A firm has invented a super-strong egg. For publicity pu...

1 year ago

Solved

Product of Each Column

Given a matrix |mat| with |n| columns, return a row vector |v| of length |n|, where every element in |v| is the product of the |...

1 year ago

Solved

Find if a given sentence is a palindrome

Given a string/character array, return true if the string is a palindrome else returns false. For example: sample_text =...

1 year ago

Solved

Remove the air bubbles from a vector

_*A reduced version of Problem 112*_ Given a column vector v, return a vector w in which all the zeros have "bubbled" to the ...

1 year ago

Solved

Funny problems

Generate the following vector： if n=1 then q=1; elseif n=2 then q=[2 2 1]; elseif n=3 then q=[3 3 3 2 2 1]; ... end

1 year ago

Solved

Bleed non-zeros to the right

What a title! Yet, it says what I mean. You get a vector, some values and a lot of zeroes. Every zero is replaced by the firs...

1 year ago

Solved

Angle between Two Vectors

The dot product relationship, a dot b = | a | | b | cos(theta), can be used to determine the acute angle between vector a and ve...

1 year ago

Solved

cross in array

Make a cross from "1" in odd size array. Other value from array should be equal to "0"; As input you get length of side of arra...

1 year ago

Solved

Feeling lucky?

Guess which number Cody is thinking (1 to 10)? (This is a game of luck more than skill. Good luck!)

1 year ago

Solved

Sum of series VII

What is the sum of the following sequence: Σ(km^k)/(k+m)! for k=1...n for different n and m?

1 year ago

Solved

convert the number to binary format & count digits

Convert the given number to the corresponding binary format and count the number of digits in that binary number

1 year ago

Solved

Perimeter of a semicircle

Given the diameter d, find the perimeter of a semicircle

1 year ago

Solved

Percentage of zeros in a matrix of only 1s and 0s

Write a function called _zero_stat_ that takes a matrix as an input that only has 0 and 1 elements. The function needs to comput...

1 year ago