849 total contributions since 2018

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

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

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

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

8 Monate 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...

9 Monate 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 ...

10 Monate 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...

10 Monate 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...

10 Monate ago

Solved

Transpose the Matrix

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

10 Monate 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*

11 Monate 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...

11 Monate 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.

11 Monate 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...

12 Monate 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 |...

12 Monate 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 =...

12 Monate 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 ...

12 Monate 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

12 Monate 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...

12 Monate 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...

12 Monate 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...

12 Monate ago

Solved

Feeling lucky?

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

12 Monate 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?

12 Monate 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

12 Monate ago

Solved

Perimeter of a semicircle

Given the diameter d, find the perimeter of a semicircle

12 Monate 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...

12 Monate ago