MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply TodayThis Challenge is derived from the Google Code Jam 2013 World Championship. The Problem B Drummer is modified for Cody. The Google question story is to find the Drummer with the Best Beat based on the Minimum Absolute Delta metric. The MAD (aka LAD) is more complicated than LMSF.

The challenge is to produce a series that has a Minimum Absolute Delta from a series of increasing values. The user series is of the form b,b+K,b+2*k,b+3*k,...,b+(N-1)*k for a set of N values.

**Input:** v ; A vector of two to ten integers of increasing values

**Output:** MAD ; the Minimum Absolute Delta of the optimum sequence from given values.

**Accuracy:** <2e-6

**Examples:**

[10 70] {0} [0 10 19 30] {0.5} [2 5 10 15 20 24]{0.75}

The Drummer Analysis may be of help. The Champions solutions can be seen at the Contest Scoreboard if a user profile is created. Java and C appear to dominate. Code Jam entries can be entered at Drummer Solve B-small.

**Best Time: 24 minutes**

12 correct solutions
8 incorrect solutions

Last solution submitted on Sep 12, 2013

1 player likes this problem

1 player likes this solution

1 Comment

Alfonso Nieto-Castanon
on 12 Sep 2013

very clever simplifications (constant term in linear model is irrelevant, and optimal slope can only take a discrete set of values)

1 Comment

Richard Zapor
on 11 Sep 2013

Tobias took at least 2 minutes to solve this challenge with Matlab. An elegant usage of a function and a Matlab optimization function. This solution also crushed the GJam BigDataset in 1.2 seconds.

1 Comment