655 total contributions since 2018

Mechanical Engineering, IIT Guwahati

Solved

Distance walked 2D

Suppose you go from x-y coordinates [3,4] to [0,0] to [0,1] to [1,1], then you walked 7 units of distance.

19 days ago

Solved

Remove element(s) from cell array

You can easily remove an element (or a column in any dimension) from a normal matrix, but assigning that value (or range) empty....

19 days ago

Solved

Cell joiner

You are given a cell array of strings and a string delimiter. You need to produce one string which is composed of each string fr...

19 days ago

Solved

Convert a Cell Array into an Array

Given a square cell array: x = {'01', '56'; '234', '789'}; return a single character array: y = '0123456789'

19 days ago

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

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

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

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

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

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

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

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

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

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

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

6 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];

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

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

6 months ago

Solved

Sum of series VI

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

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

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

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

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

6 months ago

Solved

Sum of series I

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

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

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

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

6 months ago

Solved

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

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

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

6 months ago