Solved

Find the peak 3n+1 sequence value

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

6 years ago

Solved

Find the largest value in the 3D matrix

Given a 3D matrix, A, find the largest value. E.g. >> A = 1:9; >> A=reshape(A,[3 1 3]); >> islargest(A) ans = 9

6 years ago

Solved

Number of 1s in a binary string

Find the number of 1s in the given binary string. Example. If the input string is '1100101', the output is 4. If the input stri...

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

6 years ago

Solved

Generate a vector like 1,2,2,3,3,3,4,4,4,4

Generate a vector like 1,2,2,3,3,3,4,4,4,4 So if n = 3, then return [1 2 2 3 3 3] And if n = 5, then return [1 2 2...

6 years ago

Solved

Solving Quadratic Equations (Version 1)

Quadratic equations have the form: ax^2 + bx + c = 0. Example: x^2 + 3x + 2 = 0, where a = 1, b = 3, and c = 2. The equation has...

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

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

6 years ago

Solved

Make a run-length companion vector

Given a vector x, return a vector r that indicates the run length of any value in x. Each element in r shows how many times the ...

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

6 years ago

Solved

Back to basics 14 - Keywords

Covering some basic topics I haven't seen elsewhere on Cody. Return a cell array of all MATLAB keywords

6 years ago

Solved

Say something funny

Say something funny, or not. Your solution will be (fully automatically and objectively) scored based on how clever or funny ...

6 years ago

Solved

Counting in Finnish

Sort a vector of single digit whole numbers alphabetically by their name, in Finnish. See the Wikipedia page for <http://en.wik...

6 years ago

Solved

So many choices

For inputs _n_ and _k_ (in that order), output the number of ways that k objects can be chosen from amongst n distinct objects. ...

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

6 years ago

Solved

Clean the List of Names

Given a list of names in a cell array, remove any duplications that result from different capitalizations of the same string. So...

6 years ago

Solved

Rotate a Matrix

Input a Matrix x, Output y is the matrix rotating x 90 degrees clockwise

6 years ago

Solved

Whether the input is vector?

Given the input x, return 1 if x is vector or else 0.

6 years ago

Solved

Wind Chill Computation

On a windy day, a temperature of 15 degrees may feel colder, perhaps 7 degrees. The formula below calculates the "wind chill," i...

6 years ago

Solved

How many trades represent all the profit?

Given a list of results from trades made: [1 3 -4 2 -1 2 3] We can add them up to see this series of trades made a profit ...

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

6 years ago

Solved

Back to basics 23 - Triangular matrix

Covering some basic topics I haven't seen elsewhere on Cody. Given an input matrix, return a matrix with all elements above a...

6 years ago

Solved

Project Euler: Problem 10, Sum of Primes

The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below the input, N. Thank you <http:/...

6 years ago

Solved

Back to basics 11 - Max Integer

Covering some basic topics I haven't seen elsewhere on Cody. Return the largest positive integer MATLAB can handle.

6 years ago

Solved

Indexed Probability Table

This question was inspired by a Stack Overflow question forwarded to me by Matt Simoneau. Given a vector x, make an indexed pro...

6 years ago

Solved

Find the two most distant points

Given a collection of points, return the indices of the rows that contain the two points most distant from one another. The inpu...

6 years ago

Solved

Pattern matching

Given a matrix, m-by-n, find all the rows that have the same "increase, decrease, or stay same" pattern going across the columns...

6 years ago

Solved

Flag largest magnitude swings as they occur

You have a phenomenon that produces strictly positive or negative results. delta = [1 -3 4 2 -1 6 -2 -7]; Marching thr...

6 years ago