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

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

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

6 months ago

Solved

Transpose the Matrix

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

8 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*

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

10 months 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:...

10 months ago

Solved

how many of the entries are positive?

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

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

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

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

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

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

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

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

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

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

12 months 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]

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

12 months ago

Solved

Basic Quadratic Equation

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

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

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

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

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

12 months ago

Solved

Numbers on 7-segment

This is a 7-segment: _ |_| |_| It's a 3-by-3 char matrix.It has made by 3 characters: '_' , '|' and ' ' (space...

12 months ago