Solved


Last Duplicate
Given an array of integers, find the last duplicate element — that is, the element whose second occurrence appears latest in the...

11 months ago

Solved


First Duplicate
Given an array of integers, return the first duplicate — i.e., the element that appears more than once and whose second appearan...

12 months ago

Solved


'X'avier
Given a square matrix A of size n, write a function to create a new matrix B where only the elements on the main diagonal and th...

12 months ago

Solved


Symmetric Pair
Given an (n, 2) matrix, remove any symmetric pairs from the matrix. Keep the first occurrence. (2, 3) and (3, 2) are considere...

12 months ago

Solved


Unique rows
A matrix is given as the input. Remove any duplicate rows from the matrix. keep the first occurrence.

12 months ago

Solved


Pairs with Given Sum
Given an array of integers and a target sum, return all unique pairs whose sum is equal to the target. The output should be a ma...

12 months ago

Solved


Greater than before
Given an array of integers, write a function that returns elements that are greater than the one before them. For instance, ...

12 months ago

Solved


Calculate the probability that at least two people in a group share the same birthday.
Calculate the probability that at least two people in a group share the same birthday. Given an integer input n, return to 0.015...

12 months ago

Solved


Coin change combinations.
Using only pennies (1), nickels (5), dimes (10), quarters (25), half dollars (50), and dollars (100), how many different combina...

12 months ago

Solved


Two-output anonymous function?
Return a function handle that when applied to an input, it produces two outputs: the first is the same as the input, and the sec...

12 months ago

Solved


FizzBuzz
<http://c2.com/cgi/wiki?FizzBuzzTest FizzBuzz Test> The "Fizz-Buzz test" is an interview question designed to help filter out...

12 months ago

Solved


Handle to an array of functions
Given a cell array of functions that operate on scalars, it is required to return a function handle to process a vector of value...

12 months ago

Solved


Coin Tossing: Probability of Same Heads for N tosses
A pair of physicists toss a coin n times each. What is the probability that they tossed the same number of heads? Input: N % n...

12 months ago

Solved


Get ranks of values in a vector
For a given vector, say [6 3 8 2], return the ranks (ascending) of observations, i.e. [3 2 4 1]. Do not worry about tied ranks. ...

12 months ago

Solved


Create a recurrence matrix for a vector of data
In <https://en.wikipedia.org/wiki/Conversation_analysis conversation analysis>, it's often useful to track the contributions fro...

12 months ago

Solved


Eliminate Polysyllabics: Long live short words!
Given a string s1, return s2 in which all the words with more than one syllable have been removed. To make things simple, we ...

12 months ago

Solved


Create array of all Distances between two Sets of Points : No Neural Network Toolbox
This Challenge is a subsection of <http://www.mathworks.com/matlabcentral/cody/problems/1110-usc-fall-2012-acm-martian-pranks Ma...

12 months ago

Solved


Guess the Coefficients!
Given a polynomial p known to have positive integer coefficients, deduce the values of the coefficients. For example: p = ...

12 months ago

Solved


Path of least resistance
Find the length of the shortest path through the matrix from the top left to bottom right corner. You may move right, down, or d...

12 months ago

Solved


Get an array of month-ends in a date range
Create a function that would return a list of month-ends falling in a given date range. If a start date or end date falls on a...

12 months ago

Solved


compare strings
Given 2 strings and 3 actions (Insert,delete,replace) on characters. Find the difference between two strings. Example: str...

12 months ago

Solved


Composite Trapezoidal Rule for Numeric Integration
Use the trapezoidal rule to numerically integrate a function, _f(x)_, passed as the first argument, between upper and lower limi...

12 months ago

Solved


Lagrange Interpolation
Given a set of measurements of dependent variables in a vector, Y, that vary with one independent variable in a vector, X, calcu...

12 months ago

Solved


Polynomial Interpolation
Given a set of measurements of dependent variables in a vector, Y, that vary with one independent variable in a vector, X, calcu...

12 months ago

Solved


Partial pivoting for Gauss Elimination
Write a function to implement partial pivoting for Gauss elimination, given the pivot element.

12 months ago

Solved


Forward Substitution
Solve a lower triangular linear set of equations as described in the following link: http://www.people.virginia.edu/~teh1m/cody/...

12 months ago

Solved


Forward Elimination for Gauss Elimination
Perform forward elimination for a given pivot column in the augmented matrix, Ab=[A,b]

12 months ago

Solved


Finite Continued Fraction
Given an input real number x and a natural number n, output the row vector with the n first terms of the continued fraction. F...

12 months ago

Solved


Without the French accent please!
Suppress the French accent. Example 'Déjà présent' -> 'Deja present'

12 months ago

Solved


Convert single-precision floating-point number to binary representation
Write a function which takes a scalar <http://en.wikipedia.org/wiki/Single-precision_floating-point_format single-precision floa...

12 months ago

Load more