Community Profile

# PurpleDiab

### hhh

1,046 total contributions since 2016

View details...

Contributions in
View by

Solved

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

5 days ago

Solved

Find the starting index of a consecutive condition
Given a logical vector |v|, and a positive integer |n|, return the smallest index |i| that satisfies: all( v(i : i+n-1) ) =...

5 days ago

Solved

Shuffle
Shuffle a vector by breaking it up to segments of |n| elements, and rearranging them in a reversed order. For example, the ve...

5 days ago

Solved

Conversion from hours to mili sec
Convert given input in hours to mili seconds

5 days ago

Solved

Log of a number
Write a script that will give the log of x as output.

5 days ago

Solved

raise 1/3
Raise a number to 1/3 power.

5 days ago

Solved

Prime numbers between a , b.
Find all prime number between a & b (including a and b). example: a=100 b=120 y= [101 103 107 109 113]

5 days 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

5 days ago

Solved

Second Diagonal
Transpose the matrix from it's second diagonal.

5 days ago

Solved

Win all the time!
This is a 2-players game. One of them is your algorithm. Your algorithm must win in all games. In this game there are 3 rows...

6 days ago

Solved

Draw 'O' !
Given n as input, generate a n-by-n matrix 'O' using 0 and 1 . example: n=4 ans= [1 1 1 1 1 0 0 1 ...

6 days ago

Solved

Cumulative difference
Given an array, return the cumulative difference. Example a = [ 1 3 5 7 ] cumdiff = [ 1 2 1 -2 ]

6 days ago

Solved

Find my birthday
Given a birth date x, find my age when my birth day will fall on the same day as I was born. So if I was born on Monday, what a...

6 days ago

Solved

Matrix multiplication across rows
Given matrix m, return matrix n such that, rows of n are result of multiplication of the rows of the input matrix Example ...

6 days ago

Solved

Center of mass
Given a matrix M(m,n), where m is the number of vertices of the geometrical element and n is 2 or 3 (2D-plane figure or 3D-solid...

7 days ago

Solved

Where is 1?
There is a 3d matrix [A] that consist of many zeros and only one. A=zeros(100,100,100); i=randi(100); j=randi(100); ...

7 days ago

Solved

Calculate some equation
Using given inputs x and z, make two outputs that are y1 = (xz)/(x/z)^2 + 14x^2 - 0.8z^2 y2 = x^z - z^x + (x/z)^2 - (z/x...

7 days ago

Solved

Bruh
Return 'bruh'.

7 days ago

Solved

find whether it is prime or not
For a given number find if its prime

7 days ago

Solved

Rotate a matrix for 180 degree
Rotate a matrix for 180 degree for eg: x=[1 2 3 4] y=[4 3 2 1]

7 days ago

Solved

Step up
For given input array, output a array with all elements step up by two

7 days ago

Solved

Is it prime?
Given a number, check whether it is prime or not. If prime output is true, otherwise false.

7 days ago

Solved

Area of square
Find the area of a square whose diagonal length is given as x.

7 days ago

Solved

Calculate mean value of any pair in a vector.
Given a vector A, calculate the mean of 2 number in the vector one by one. example: input: A=[1, 5, 6, 8, 9, 15] output:...

7 days ago

Solved

Draw 'B'
Draw a x-by-x matrix 'B' using 1 and 0. (x is odd and bigger than 4) Example: x=5 ans= [1 1 1 1 0 1 0 0 0 1 ...

7 days ago

Solved

* Imagine you are in 2222 Anno Domini, when everyone must learn how to add, * and competing for the highly prestigious post of,...

10 days ago

Solved

root?
* Given a function 'foo', and a position 'there', find the root near 'there'. * For example: If foo=@sin, and there=3.1, then r...

10 days ago

Solved

calculate linear convolution two vectors
for e.g in: a = [1 2 3] b = [4 5 6] out: y = [4 13 28 27 18]

11 days ago

Solved

Volume of a sphere given its surface area
You just measured its surface area, that is the input.

11 days ago

Solved

Convert hex color specification to MATLAB RGB
Here's something that comes up all the time if you deal with web pages. Given a <http://www.w3schools.com/html/html_colors.as...

11 days ago