Faculty member in civil & environmental engineering

Solved

Number Persistence

A number's persistence is the number of steps required to reduce it to a single digit by multiplying all its digits to obtain a ...

42 minutes ago

Solved

Number of divisors of a given number

Given a Number n, return the number of his divisors without listing them example: n=14 ; Divisors={1,7,2,14} ; y=4 n=...

1 hour ago

Solved

Replace Nonzero Numbers with 1

Given the matrix x, return the matrix y with non zero elements replaced with 1. Example: Input x = [ 1 2 0 0 0 ...

8 hours ago

Solved

Vertical matrix sort

Given a matrix x with n rows and m columns, return a matrix y with 2n rows and m columns, such that every column in x is sorted ...

9 hours ago

Solved

Shuffle

Shuffle a vector by breaking it up to segments of |n| elements, and rearranging them in a reversed order. For example, the ve...

10 hours ago

Solved

Back to basics 9 - Indexed References

Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix and row and column, output the index of th...

10 hours ago

Solved

Big numbers, least significant digits

Given two numbers, x and n, return the last d digits of the number that is calculated by x^n. In all cases, d will be the number...

12 hours ago

Solved

Find the area of a triangle having vertices (A,B), (C,D), and (E,F)

Find the area of a triangle using if we have the three vertices of the triangle

21 hours ago

Solved

Calculate the sum of two polynomials

Calculate the sum of two polynomials if they are written in notation with their coefficients. example: a=[3 4 5]; b=[...

21 hours ago

Solved

Three...is a magic number.

Yes it is... It's a magic number... To help you get rid of that earworm, here's a new Cody problem. You are given a squar...

21 hours ago

Solved

Horizontal matrix sort

Given a matrix x with n rows and m columns, return a matrix y with n rows and 2m columns, such that every row in x is sorted fro...

22 hours ago

Solved

Who has power to do everything in this world?

There is only one person who is older than this universe. He is Indian version of Chuck Norris.

22 hours ago

Solved

Calculate distance travelled when given radius and rotations

When given radius of wheel and number of rotations calculate total distance travelled consider pi=3.14

22 hours 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 ] ...

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

22 hours ago

Solved

Sum of the Matrix Elements

Add up all the elements in a NxM matrix where N signifies the number of the rows and M signifies the number of the columns. E...

22 hours ago

Solved

Better Index Number

Let's say you want to save many, many files and append these files with a certain sortable index number. As you probably know, y...

22 hours ago

Problem

Determine digits of the Copeland-Erdos constant

<https://www.mathworks.com/matlabcentral/cody/problems/1477-champernowne-constant/solutions/new Cody Problem 1477> asks us to de...

23 hours ago | 1

Solved

How many days in a month?

Return the number of days in a given month in 2017. If the input is not a valid month number, return -1. Examples: Input...

1 day ago

Solved

Golomb's self-describing sequence (based on Euler 341)

The Golomb's self-describing sequence {G(n)} is the only nondecreasing sequence of natural numbers such that n appears exactly G...

1 day ago

Solved

Back to basics 12 - Input Arguments

Covering some basic topics I haven't seen elsewhere on Cody. Return a value equal to the number of input arguments to the fun...

1 day ago

Solved

Product of Each Column

Given a matrix |mat| with |n| columns, return a row vector |v| of length |n|, where every element in |v| is the product of the |...

1 day ago

Solved

cos for boss?

a programmer had too much coffee and his boss needs cos(alpha+beta) correctly, especially when alpha or beta are close to pi/2 a...

1 day ago

Solved

Filter AC, pass DC

Input x is the sampled signal vector, may have both AC and DC components. Output vector y should not contain any AC component. ...

1 day ago

Solved

MATCH THE STRINGS (2 CHAR) very easy

Match the given string based on first two characters on each string. For example A='harsa'; b='harish'; result '1' ...

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

1 day ago

Solved

Complex transpose

Calculate the transpose of a matrix having complex numbers as its elements without changing the signs of the imaginary part. ...

1 day ago

Solved

Matrix multiplication across rows

Given matrix m, return matrix n such that, rows of n are result of multiplication of the rows of the input matrix Example ...

1 day ago

Solved

Getting the absolute index from a matrix

This is a basic MATLAB operation. It is for instructional purposes. --- You may already know how to get the <http://www.ma...

1 day ago