Solved

Multiply a column by a row

* Given a column vector C and and a row vector R. * Output a matrix M. * Every column of M equals to C multiplied by correspon...

8 months ago

Solved

Element by element multiplication of two vectors

Given two input vectors, return the element-by-element product. Example A = [1 2 3] B = [7 3 1] The answer should be...

8 months ago

Solved

Find the sum of the elements in the "second" diagonal

Find the sum of the elements in the diagonal that starts at the top-right corner and ends at the bottom-left corner.

8 months ago

Solved

Find out value of sine given by degree.

Find out value of sine given by degree. If theta=30, it's value must be 0.5.

8 months ago

Solved

Sum the squares of numbers from 1 to n

For a given value of n return the sum of square of numbers from 1 to n. Example For n = 2 then sum of squares = 5 (1^2 + ...

8 months ago

Solved

Finding perimeter of a rectangle

A rectangle has a length of x centimeters and a width of w centimeters. Find the perimeter.

8 months ago

Solved

Matrix of almost all zeros, except for main diagonal

Write a program to input an integer n and build a n-by-n matrix with the numbers 1,2,...,n on the main diagonal and zeros elsewh...

8 months ago

Solved

Find the two most distant points

Given a collection of points, return the indices of the rows that contain the two points most distant from one another. The inpu...

8 months ago

Solved

Return the 3n+1 sequence for n

A Collatz sequence is the sequence where, for a given number n, the next number in the sequence is either n/2 if the number is e...

8 months ago

Solved

wythoff sequence

find the lower wythoff sequence upto n; https://oeis.org/A000201

8 months ago

Solved

Quadratic equation

given three inputs (a, b, c) for the equation a*x^2+b*x+c=0; return 1 if the roots are complex (non zero imaginary), and 0 if th...

8 months ago

Answered

Listing elements from one matrix to another

The formatting in the example you gave us did not translate well; however, the best way to do this can avoid for loops entirely....

Listing elements from one matrix to another

The formatting in the example you gave us did not translate well; however, the best way to do this can avoid for loops entirely....

8 months ago | 0

| accepted

Solved

Orientation of a 3D coordinate frame

The orientation of a body-fixed frame {B} with respect to the world frame {W} is described by an SO(3) rotation matrix. Compute...

8 months ago

Solved

Summing digits

Given n, find the sum of the digits that make up 2^n. Example: Input n = 7 Output b = 11 since 2^7 = 128, and 1 + ...

8 months ago

Solved

Guess the number I'm thinking of

In this game you are competing against two other people to guess the number that I'm thinking of. # I randomly choose an *i...

8 months ago

Solved

Return fibonacci sequence do not use loop and condition

Calculate the nth Fibonacci number. Given n, return f where f = fib(n) and f(1) = 1, f(2) = 1, f(3) = 2, ... Examples: ...

8 months ago

Solved

Integer Sequence - II : New Fibonacci

Crack the following Integer Sequence. (Hints : It has been obtained from original Fibonacci Sequence and all the terms are also ...

8 months ago

Solved

Find the next Fibonacci number

In the sequence of Fibonacci numbers, every number is the sum of the two preceding ones: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55...

8 months ago

Solved

Return the Fibonacci Sequence

Write a code which returns the Fibonacci Sequence such that the largest value in the sequence is less than the input integer N. ...

8 months ago

Solved

Given a square and a circle, please decide whether the square covers more area.

You know the side of a square and the diameter of a circle, please decide whether the square covers more area.

8 months ago

Solved

Perimeter of a semicircle

Given the diameter d, find the perimeter of a semicircle

8 months ago

Solved

Rotate a matrix without using rot90

rotate the input square matrix by certain degrees (e.g. 270 or 450 etc.) without using rot90 or flip function. its an extension...

8 months ago

Solved

find nth even fibonacci number

1st even fibonacci number=2 ; 2nd even fibonacci number=8 ..

8 months ago

Solved

Calculate Inner Product

Given two input matrices, |x| and |y|, check if their inner dimensions match. * If they match, create an output variable |z|...

8 months ago

Solved

Calculate a Damped Sinusoid

The equation of a damped sinusoid can be written as |y = A.ⅇ^(-λt)*cos(2πft)| where |A|, |λ|, and |f| ...

8 months ago

Solved

Solve a System of Linear Equations

*Example*: If a system of linear equations in _x₁_ and _x₂_ is: 2 _x₁_ + _x₂_ = 2 _x₁...

8 months ago

Solved

Verify Law of Large Numbers

If a large number of fair N-sided dice are rolled, the average of the simulated rolls is likely to be close to the mean of 1,2,....

8 months ago