651 total contributions since 2018

Mechanical Engineering, IIT Guwahati

Solved

Bullseye Matrix

Given n (always odd), return output a that has concentric rings of the numbers 1 through (n+1)/2 around the center point. Exampl...

2 months ago

Solved

Can we make a triangle?

Given three positive number, check whether a triangle can be made with these sides length or not. remember that in a triangle su...

2 months ago

Solved

Determine the number of odd integers in a vector

Determine the number of unique odd integers in a vector. Examples: Input x = [2 5 8 3 7 1]; Output y = 4; Inp...

2 months ago

Solved

Height of a right-angled triangle

Given numbers a, b and c, find the height of the right angled triangle with sides a and b and hypotenuse c, for the base c. If a...

2 months ago

Solved

Create a vector whose elements depend on the previous element

The idea is to create a vector A whose elements depend on the previous element : *A(i+1) = 2*A(i)+1* *2 Inputs*: - A : The...

2 months ago

Solved

Tick. Tock. Tick. Tock. Tick. Tock. Tick. Tock. Tick. Tock.

Submit your answer to this problem a multiple of 5 seconds after the hour. Your answer is irrelevant; the only thing that matte...

5 months ago

Solved

Kaprekar numbers

Test if the input is a Kaprekar number: <http://mathworld.wolfram.com/KaprekarNumber.html>. Return a logical true or false. ...

5 months ago

Solved

Flip the main diagonal of a matrix

Given a n x n matrix, M, flip its main diagonal. Example: >> M=magic(5); >> flipDiagonal(M) 9 24 1 ...

5 months ago

Solved

Replace every 3rd element in a vector with 4

x is a vector of undetermined length You are to replace every 3rd element with the number 4, example: x = [11 23 34 43 2 3...

5 months ago

Solved

Do you like your boss?

Do you like your boss? Answer can be any string! For example: Boss = 'Do you like your boss?'; Output = 'yes' or ...

5 months ago

Solved

Basics - not so easy division

Please make a function whcih divides x/y, but pay attention for some exceptions with NaN,0,Inf. Sometimes return "ERROR" instead...

5 months ago

Solved

Basic commands - rounding

make a function which will round to integer, which is nearer to zero. Example x=[-2.5 2]; y=[-2 2];

5 months ago

Solved

Basic commands - Least common multiple

Make a function which will return least common multiple of "a" and "b" Example: a=8; b=6; y=24;

5 months ago

Solved

Solve the set of simultaneous linear equations

Given this pair of simultaneous linear equations: 2x + 3y = 23 3x + 4y = 32 Find the solution set (x,y)

5 months ago

Solved

Sum of series VI

What is the sum of the following sequence: Σk⋅k! for k=1...n for different n?

5 months ago

Solved

Sum of a geometric series

Give the sum of the first 'n' terms of a geometric series, given 'a' as the first term and 'r' as the ratio.

5 months ago

Solved

Sum of series IV

What is the sum of the following sequence: Σ(-1)^(k+1) (2k-1)^2 for k=1...n for different n?

5 months ago

Solved

Sum of series III

What is the sum of the following sequence: Σ(2k-1)^3 for k=1...n for different n?

5 months ago

Solved

Sum of series II

What is the sum of the following sequence: Σ(2k-1)^2 for k=1...n for different n?

5 months ago

Solved

Sum of series I

What is the sum of the following sequence: Σ(2k-1) for k=1...n for different n?

5 months ago

Solved

What is Sum Of all elements of Matrix

Given the matrix x, return the sum of all elements of matrix. Example: Input x = [ 1 2 0 0 0 0 6 9 3 3 ] ...

5 months ago

Solved

Back to basics 7 - Equal NaNs

Covering some basic topics I haven't seen elsewhere on Cody. Given 2 input variables, output true if they are equal, false ot...

5 months ago

Solved

Find the index of the largest value in any vector X=[4,3,4,5,9,12,0,4.....5]

The given function returns the index of the maximum value in a given matrix. such as X=[4,3,4,5,9,12,0,5] Ans= 6 if maxim...

5 months ago

Solved

NaN (欠損値) が含まれている行を削除しよう

行列 A が与えられたとき、その行列の中に NaN (Not a number; 欠損値) の要素がある行を見つけ出し、その行を削除しましょう。 例: A = [ 1 5 8 -3 NaN 14 ...

5 months ago

Solved

An asteroid and a spacecraft

🚀 Imagine a non-relativistic simple situation. Assume positions p0, p1, p2, and p3 are three dimensional Cartesian ...

5 months ago

Solved

The 5th Root

Write a function to find the 5th root of a number. It sounds easy, but the typical functions are not allowed (see the test su...

5 months ago

Solved

Return unique values without sorting

If the input vector A is [42 1 1], the output value B must be the unique values [42 1] The *values of B are in the s...

5 months ago

Solved

Pi Estimate 1

Estimate Pi as described in the following link: <http://www.people.virginia.edu/~teh1m/cody/Pi_estimation1.pdf>

6 months ago

Solved

Approximation of Pi

Pi (divided by 4) can be approximated by the following infinite series: pi/4 = 1 - 1/3 + 1/5 - 1/7 + ... For a given numbe...

6 months ago