Solved

Draw 'I'

Given n as input, draw a n-by-n matrix 'I' using 0 and 1. example: n=3 ans= [0 1 0 0 1 0 0 1 0] n=...

8 months ago

Solved

Cube root of max value in a vector

Find the cube root of the maximum value in a vector

9 months ago

Solved

Cannibal eating odd and even numbered men

There are N men in a queue. A cannibal eats either all odd-numbered or all even-numbered men in the queue at a time. In the fi...

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

9 months ago

Solved

How many days?!?

Christmas is coming earlier and earlier each year. Thanks to rampant commercialism and Christmas Creep, "The Twelve Days of Chr...

9 months ago

Solved

Transpose the Matrix

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

11 months 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

Prime Product

My professor has given a sequence of N numbers as a1, a2, ..., aN and asked me to find the smallest possible value of ai * aj su...

1 year ago

Solved

count upper and lower case characters

In a given input string, count and return the number of upper and lower case characters as u and l respectively. For example:...

1 year ago

Solved

how many of the entries are positive?

Given x= sin(linspace(0,10*pi,100)), how many of the entries are positive?

1 year ago

Solved

Sum of unique multiples of 3 and 5

If we list all the natural numbers up to 15 that are multiples of 3 or 5, we get 3, 5, 6, 9, 10, 12 and 15. The sum of these mul...

1 year ago

Solved

Determinants

Given a square matrix(A), find the determinant(d). For example: A = [1,3;4,5] d = 1*5-4*3 = -7

1 year ago

Solved

The answer to life the universe and everything

Write a function that gives the answer to life the universe and everything to every input except the input is 42. In this case t...

1 year ago

Solved

determine the sum of fraction part for given matrix

determine the sum of fraction part for given matrix a=1.8308 8.9172 6.7537 1.5853 10.2858 5.3804 6.5497 ...

1 year ago

Solved

Basic Monte Carlo Simulation

Input is a matrix including service time and probability of service time. Another input is a random number. Function should tran...

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

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]

1 year ago

Solved

basic matrix operations: rotate and find sum of diagonal elements of the resultant matrix

For given input matrix a, rotate it by 90 degrees and find the sum of the diagonals. Example: Input: a = 1 ...

1 year ago

Solved

Draw 'J'

Given n as input, generate a n-by-n matrix 'J' using 0 and 1 . Example: n=5 ans= [0 0 0 0 1 0 0 0 0 1 0 0 ...

1 year ago

Solved

Draw 'D'.

Draw a x-by-x matrix 'D' using 0 and 1. example: x=4 ans= [1 1 1 0 1 0 0 1 1 0 0 1 1 1 1 0]

1 year ago

Solved

Calculate time taken by light to reach earth surface

We know the time(seconds) taken by light to reach surface of earth. What if the distance varies yearly or source of light moves ...

1 year ago

Solved

Basic Quadratic Equation

Create the equation: y=(3x)^2+(5x)+35 and compute y for various values of x

1 year ago

Solved

Perfect square.

Determine if the input is a perfect square or not. Example - If input is 25, return 1. If input is 17, return 0.

1 year ago

Solved

Draw 'E'

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

1 year ago

Solved

Draw 'F'

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

1 year ago

Solved

Draw 'H'

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

1 year ago