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

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

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

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

environ un an 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...

environ un an 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 ...

environ un an 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...

environ un an 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...

environ un an ago

Solved

Transpose the Matrix

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

environ un an 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*

environ un an 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...

plus d'un an 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.

plus d'un an 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...

plus d'un an 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 |...

plus d'un an 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 =...

plus d'un an ago

Solved

find the logic,easy one

find the logic behind, example x=18 y=306 x=53 y=2756

plus d'un an 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 ...

plus d'un an 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

plus d'un an 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...

plus d'un an 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...

plus d'un an 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...

plus d'un an ago

Solved

Feeling lucky?

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

plus d'un an 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?

plus d'un an 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

plus d'un an ago

Solved

Perimeter of a semicircle

Given the diameter d, find the perimeter of a semicircle

plus d'un an 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...

plus d'un an ago