94 total contributions since 2019

Solved

Who Has the Most Change?

You have a matrix for which each row is a person and the columns represent the number of quarters, nickels, dimes, and pennies t...

5 giorni ago

Solved

Program an exclusive OR operation with logical operators

Program an exclusive or operation *without* using the MATLAB function xor. Use logical operators like |, &, ~, ... instead. ...

8 giorni ago

Solved

De-dupe

Remove all the redundant elements in a vector, but keep the first occurrence of each value in its original location. So if a =...

24 giorni ago

Solved

Which values occur exactly three times?

Return a list of all values (sorted smallest to largest) that appear exactly three times in the input vector x. So if x = [1 2...

26 giorni ago

Solved

Remove all the consonants

Remove all the consonants in the given phrase. Example: Input s1 = 'Jack and Jill went up the hill'; Output s2 is 'a ...

26 giorni ago

Solved

Magic is simple (for beginners)

Determine for a magic square of order n, the magic sum m. For example m=15 for a magic square of order 3.

27 giorni ago

Solved

Remove the vowels

Remove all the vowels in the given phrase. Example: Input s1 = 'Jack and Jill went up the hill' Output s2 is 'Jck nd Jll wn...

27 giorni ago

Solved

Add two numbers

Calculate the sum of two numbers. Example input = [2 3] output = 5

circa un mese ago

Solved

Pangrams!

A pangram, or holoalphabetic sentence, is a sentence using every letter of the alphabet at least once. Example: Input s ...

circa un mese ago

Solved

Find the alphabetic word product

If the input string s is a word like 'hello', then the output word product p is a number based on the correspondence a=1, b=2, ....

circa un mese ago

Solved

Triangle sequence

A sequence of triangles is constructed in the following way: 1) the first triangle is Pythagoras' 3-4-5 triangle 2) the s...

circa un mese ago

Solved

Trimming Spaces

Given a string, remove all leading and trailing spaces (where space is defined as ASCII 32). Input a = ' singular value deco...

circa un mese ago

Solved

Counting Sequence

Given a vector x, find the "counting sequence" y. A counting sequence is formed by "counting" the entries in a given sequence...

circa un mese ago

Solved

Roll the Dice!

*Description* Return two random integers between 1 and 6, inclusive, to simulate rolling 2 dice. *Example* [x1,x2] =...

circa un mese ago

Solved

surface of a spherical planet

you just discovered its circumference, that is the input.

circa un mese ago

Solved

Back to basics 6 - Column Vector

Covering some basic topics I haven't seen elsewhere on Cody. Given an input vector, output true or false whether it is a colu...

circa un mese ago

Solved

Find a Pythagorean triple

Given four different positive numbers, a, b, c and d, provided in increasing order: a < b < c < d, find if any three of them com...

circa un mese ago

Solved

Which doors are open?

There are n doors in an alley. Initially they are all shut. You have been tasked to go down the alley n times, and open/shut the...

circa un mese ago

Solved

Reverse Run-Length Encoder

Given a "counting sequence" vector x, construct the original sequence y. A counting sequence is formed by "counting" the entrie...

circa un mese ago

Solved

Flipping

Write code that can reverse the vector without using any sort of loop. Example Given the input vector A = [ 1 2 3 4 5...

circa un mese ago

Solved

Compute a dot product of two vectors x and y

x and y are input vectors, d is a number and contains their dot product

circa un mese 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...

circa un mese ago

Solved

Who is the smartest MATLAB programmer?

Who is the smartest MATLAB programmer? Examples: Input x = 'Is it Obama?' Output = 'Me!' Input x = 'Who ?' Ou...

circa un mese ago

Solved

Back to basics 22 - Rotate a matrix

Covering some basic topics I haven't seen elsewhere on Cody. Rotate the input matrix 90 degrees counterclockwise (e.g. [1 2; ...

circa un mese ago

Solved

Determine Whether an array is empty

Input a matrix x, output y is TRUE if x is empty, otherwise FALSE.

circa un mese ago

Solved

Back to basics 8 - Matrix Diagonals

Covering some basic topics I haven't seen elsewhere on Cody. Given an input vector of numbers, output a square array with the...

circa un mese 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

circa un mese ago

Solved

Sorted highest to lowest?

Return 1 if the input is sorted from highest to lowest, 0 if not. Example: 1:7 -> 0 [7 5 2] -> 1

circa un mese ago