Solved

Pascal's Triangle

Given an integer n >= 0, generate the length n+1 row vector representing the n-th row of <http://en.wikipedia.org/wiki/Pascals_t...

meer dan een jaar ago

Solved

Back and Forth Rows

Given a number n, create an n-by-n matrix in which the integers from 1 to n^2 wind back and forth along the rows as shown in the...

meer dan een jaar ago

Solved

Duplicate each element of a vector.

for an n-dimensional vector x, the function should return another vector 2n-dimension which each element is repeated twice. Ex...

meer dan een jaar ago

Solved

Simple equation: Annual salary

Given an hourly wage, compute an annual salary by multiplying the wage times 40 and times 50, because salary = wage x 40 hours/w...

meer dan een jaar 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...

meer dan een jaar ago

Solved

Card Game

This is an overly simplified and highly modified version of card game Twenty-Nine. A deck of 100 unique cards (hypothetical) ...

meer dan een jaar ago

Solved

Find the 9's Complement

Find the 9's complement of the given number. An example of how this works is <http://electrical4u.com/9s-complement-and-10s-c...

meer dan een jaar ago

Solved

Return elements unique to either input

Given two numeric inputs a and b, return a row vector that contains the numbers found in only a or only b, but not both. For ex...

meer dan een jaar ago

Solved

Weighted average

Given two lists of numbers, determine the weighted average. Example [1 2 3] and [10 15 20] should result in 33.333...

bijna 2 jaar 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...

bijna 2 jaar ago

Solved

Energy of a photon

*⚛ ☢ ⚛ ☢ ⚛ ☢ ⚛* Given the frequency F of a photon in giga hertz. Find energy E of this...

bijna 2 jaar ago

Solved

Find all elements less than 0 or greater than 10 and replace them with NaN

Given an input vector x, find all elements of x less than 0 or greater than 10 and replace them with NaN. Example: Input ...

bijna 2 jaar ago

Solved

Fibonacci sequence

Calculate the nth Fibonacci number. Given n, return f where f = fib(n) and f(1) = 1, f(2) = 1, f(3) = 2, ... Examples: Inpu...

bijna 2 jaar ago

Solved

Generate a NaN...on purpose

The goal is to create a function that will return a single "NaN" without using the nan function. I am interested to see how many...

bijna 2 jaar ago

Solved

Finding Perfect Squares

Given a vector of numbers, return true if one of the numbers is a square of one of the other numbers. Otherwise return false. E...

ongeveer 2 jaar ago

Solved

Number of Horns on a unicorn!

Calculate the number of horns on a *unicorn*! And I'm talking about a unicorn with not more than one horn on it!

ongeveer 2 jaar ago

Solved

Rotate and display numbered tile

Imagine a square tile with four numbers on it, one on each edge. We will call these edges north, east, south, and west. If th...

ongeveer 2 jaar ago

Solved

Find best placement for ordered dominoes (harder)

Given a list of ordered pairs, find the order they should be placed in a line, such that the sum of the absolute values of the d...

ongeveer 2 jaar ago

Solved

Stuff the Board

You have a stack of tiles to put onto an array-like playing board. Each tile has a number (always an integer), and the board var...

ongeveer 2 jaar ago

Solved

Find perfect placement of non-rotating dominoes (easier)

Given a list of ordered pairs, find the order they should be placed in a line, such that the sum of the absolute values of the d...

ongeveer 2 jaar ago

Solved

Scoring for oriented dominoes

Given a list of ordered pairs, and the order they should be placed in a line, find the sum of the absolute values of the differe...

ongeveer 2 jaar ago

Solved

Find best domino orientation

Given a list of pairs, find the orientation they should be placed in a line, such that the sum of the absolute values of the dif...

ongeveer 2 jaar ago

Solved

Length of a short side

Calculate the length of the short side, a, of a right-angled triangle with hypotenuse of length c, and other short side of lengt...

ongeveer 2 jaar ago

Solved

Is this triangle right-angled?

Given three positive numbers a, b, c, where c is the largest number, return *true* if the triangle with sides a, b and c is righ...

ongeveer 2 jaar ago

Solved

Code breaker, Part I: Operation Phoenix

You have been tasked with decoding a set of coded messages that have been intercepted. Based on previous intelligence that ...

ongeveer 2 jaar ago

Solved

Getting logical indexes

This is a basic MATLAB operation. It is for instructional purposes. --- Logical indexing works like this. thresh = 4...

ongeveer 2 jaar ago

Solved

Replicate elements in vectors

Replicate each element of a row vector (with NaN) a constant number of times. Examples n=2, A=[1 2 3] -> [1 1 2 2 3 3] ...

ongeveer 2 jaar ago

Solved

How to subtract?

*± ± ± ± ± ± ± ± ± ± ±* * Imagine you need to subtract one...

ongeveer 2 jaar 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...

ongeveer 2 jaar ago

Solved

Leap years on other planets

A year is a leap year if it is divisible by 4, but not if it is divisible by 100, unless it is also divisible by 400. This mean...

meer dan 2 jaar ago