Solved


Sort Reversal
There are n index cards in a row, with n distinct integers written on them (one number per card) so that the numbers are sorted ...

2 months ago

Solved


Moving Product (Easy)
Given an input array A, write a function *movprod(A,k,dim)* to calculate the moving product over a sliding window of length *k* ...

2 months ago

Solved


The Tortoise and the Hare - 01
Suppose in an infinitely long line, the hare is standing in position 0. From that place, it can jump either in the +ve direct...

2 months ago

Solved


Spiral Matrix
for a given integer n>=3, generate a matrix of nxn such that the value n^2 is at bottom left and its decreasing towards center ...

2 months ago

Solved


Binary code for an analog signal
Digitization of a signal consists of 3 stages: sampling, quantization and encoding. Sampling convert the analogue signal into p...

2 months ago

Solved


hanoi towers II
with 3 rods (1,2 & 3), the goal is to move a tower of n disks from rod #1 to rod #3. You can move disks only one by one, on the...

2 months ago

Solved


Create a matrix that counts up diagonally
Given a single input _N_, create a _N_ x _N_ matrix that counts from 1 : _N_ ², (along up-right diagonals, starting with 1 in th...

2 months ago

Solved


Beat the RNG - EASY

2 months ago

Solved


How close to a hole
Suppose you have a description of good places (ones) and bad places (zeros). You want to know your distance from a bad place (in...

2 months ago

Solved


Fun with a compass
Each night for the past week, you have been having the same nightmare: You find yourself back in your junior high school geometr...

2 months ago

Solved


Convert a vector to a lower triangular matrix
I now have a row vector and I want to convert it to a lower trilangular matrix. The rows of the lower trilangular matrix have t...

2 months ago

Solved


Prime Time
All you need to do here is submit your solution a prime number of seconds after the top of the hour. Any hour at all... Easy, ...

2 months ago

Solved


Climbing the stairs

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

2 months ago

Solved


Rank of magic square (for beginners)
Compute the rank r of a magic square of order n WITHOUT rank and magic functions.

2 months ago

Solved


Young's modulus
Given a value of <http://en.wikipedia.org/wiki/Young_modulus Young's modulus> (Y) expressed on MegaPascal, convert it to the uni...

2 months ago

Solved


Subtract two positive numbers
Given a and b as a string, return b-a without using string to number conversion functions. a and b must to be a same size and b ...

2 months ago

Solved


Generate Hadamard Matrix without using hadamard function
In mathematics, a Hadamard matrix, named after the French mathematician Jacques Hadamard, is a square matrix whose entries are e...

2 months ago

Solved


Queen's move
given a number of consecutive moves of queen, check for their validity based on their previous position.... but remember if u g...

2 months ago

Solved


Create a 3D rotation matrix from roll-pitch-yaw angles
Consider a robotics application where the world reference coordinate frame {W} and a robot manipulator arm with an attached tool...

2 months ago

Solved


Moving Median Absolute Deviation
The median absolute deviation (MAD) is defined as MAD = median(abs(A − median(A))) for a rolling window of length n. For examp...

2 months ago

Solved


Recurrence relation
A recurrence relation is given by P(1) := 1 P(n+1) := exp(1) - (n+1)*P(n) Write a function that, given an integer |...

2 months ago

Solved


Upstairs!
The stair has n steps. Every times you can up one or two steps. Give all the different solutions to upstairs. For example n ...

2 months ago

Solved


Higher! Lower!
My kids have started to play the "I'm thinking of a number between X and Y" game in the car on trips to and from their swim less...

2 months ago

Solved


Determine roll pitch yaw angles from a 3D rotation matrix
Consider an aerospace application where the world reference coordinate frame {W} and a body-fixed coordinate frame {B}. The ori...

2 months ago

Discussion


Using the Extended Euclidean Algorithm & Bézout’s Theorem
Many MATLAB Cody problems involve solving congruences, modular inverses, Diophantine equations, or simplifying ratios under cons...

2 months ago | 0

Solved


Now 20% off!
Furloughs are hitting government workers this year. To commemorate getting one unpaid day off each week until the end of Septem...

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

2 months ago

Load more