Solved

Elapsed Time

Given two date strings d1 and d2 of the form yyyy/mm/dd HH:MM:SS (assume hours HH is in 24 hour mode), determine how much time, ...

8 years ago

Solved

Replace Vector Elements

Replace all elements in a vector which are equal to or smaller than zero with 0.1. Example: A = [1 2 3 -1 0 2 -3 -80]; ...

8 years ago

Solved

N-Queens Checker

Picture a chessboard populated with a number of queens (i.e. pieces that can move like a queen in chess). The board is a matrix,...

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

8 years ago

Solved

Ordinal numbers

Given an integer n, return the corresponding ordinal number as a character string. For example, ord(1)='1st' ord(2)=...

8 years ago

Solved

Find nearest prime number less than input number

Find nearest prime number less than input number . For example: if the input number is 125, then the nearest prime number whi...

8 years ago

Solved

Unique values without using UNIQUE function

You must return unique values in a vector in *stable* mode without using the unique function. About stable order flag: ...

8 years ago

Solved

Make a Star Pyramid

Create a star pyramid. First line will have 1 star, second will have two stars and so on... a basic program which is easily done...

8 years ago

Solved

Rotate input square matrix 90 degrees CCW without rot90

Rotate input matrix (which will be square) 90 degrees counter-clockwise without using rot90,flipud,fliplr, or flipdim (or eval)....

8 years ago

Solved

Is this matrix orthogonal?

Given a square matrix, a, determine whether it is orthogonal. INPUT: a, a n x n matrix OUTPUT: true or false

8 years ago

Solved

Find common elements in matrix rows

Given a matrix, find all elements that exist in every row. For example, given A = 1 2 3 5 9 2 5 9 3 2 5 9 ...

8 years ago

Solved

Find relatively common elements in matrix rows

You want to find all elements that exist in greater than 50% of the rows in the matrix. For example, given A = 1 2 3 5 ...

8 years ago

Solved

Cody Matlab Version

What is the current Cody Matlab Release? *Output:* string *Examples:* '(R2012a)' or 'R2012a' Hint: We have mo...

8 years ago

Solved

"mirror" matrix

Create n x 2n "mirror" matrix of this type: e.g. for n = 2 m = [1 2 2 1;1 2 2 1] e.g. for n = 3 m = [1 2 3 3 2 1...

8 years ago

Solved

Fill a zeros matrix

The aim is to fill an array of all zeros given a numerical value and the index of row and columns for this value. 3 Inputs: ...

8 years ago

Solved

System of equations

Find a solution to a system of equations represented by a |n| by |n+1| matrix. For instance, [ 2 0 4; => 2*x = 4 ...

8 years ago

Solved

Number of Circles in a Number

Given a number, return the number of closed 'circles' in the base 10 numerical representation. Note: the number 4 has no circ...

8 years ago

Solved

Is A the inverse of B?

Given a matrix A and a matrix B, is A the inverse of B? >>A=[2,4;3,5]; >>B=[-2.5,2;1.5,-1]; >>isInverse...

8 years ago

Solved

Create a square matrix of multiples

Given an input, N, output a matrix N x N with each row containing multiples of the first element of each row. This also applies...

8 years ago

Solved

Back to basics 13 - Input variables

Covering some basic topics I haven't seen elsewhere on Cody. Return as a string the name of the input variable to the functio...

8 years ago

Solved

Back to basics 15 - classes

Covering some basic topics I haven't seen elsewhere on Cody. Return the class of the input variable.

8 years ago

Solved

2 b | ~ 2 b

Given a string input, output true if there are 2 b's in it, false if otherwise Examples: 'Macbeth' -> false 'Publius Cor...

8 years ago

Solved

Back to basics 21 - Matrix replicating

Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix, generate an output matrix that consists o...

8 years ago

Solved

Back to basics 20 - singleton dimensions

Covering some basic topics I haven't seen elsewhere on Cody. Remove the singleton dimensions from the input variable (e.g. if...

8 years ago

Solved

Back to basics 1 - Saving

Covering some basic topics I haven't seen elsewhere on Cody. Given an input variable 'x', save it to disk in a file named 'co...

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

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

8 years ago

Solved

Remove all the words that end with "ain"

Given the string s1, return the string s2 with the target characters removed. For example, given s1 = 'the main event' your ...

8 years ago

Solved

Sum of diagonal of a square matrix

If x = [1 2 4; 3 4 5; 5 6 7] then y should be the sum of the diagonals of the matrix y = 1 + 4 + 7 = 12

8 years ago

Solved

Number of 1s in the Binary Representation of a Number

*Description* Return the number of 1s in the (unsigned integer) binary representation of a number. This function should be ab...

8 years ago