Latest News Feb 10 10:05AM EST 

The winners page is now online. Find out more about our winners and read their contest stories! We've also posted some statistics and commentary about the evolution of the contest and an analysis of some of the code

Per Rutquist is our overall MATLAB Golf Champion. He came away with two first place finishes and two second place finishes. We'll send him a MATLAB Jacket.

Congratulations to all of our first-place finishers: Guy Shechter, Imre Polik, Stijn Helsen, Per Rutquist, Claus Still, François Glineur, and Nicke. You will each receive a MATLAB toolkit.

You can now download the full testsuites used in the contest from the File Exchange.

If you'd like to hear about the next contest, sign up for our Contest Announcement mailing list. To subscribe send e-mail to lists@mathworks.com with subscribe contest-announce in the body.

All holes: frequencies, palindrome, encryption, infection, heaviest, pathfinder, and snake.

Sequence Frequencies

Given a vector a and a vector b of non-negative integers, create a row vector c that contains b(1) copies of a(1), b(2) copies of a(2), and so on. As an additional condition, no two identical values can appear next to each other in the answer c. So when

a = [ 1  2  3 ]
b = [ 2  2  1 ]

one answer is

c = [ 1     2     3     1     2 ]

Leaders

Place Submitted Entry Author Length
1 11:49:03 j11 Guy Shechter 36
2 11:19:18 j1 Julian 37
3 10:37:40 Pretty good Mark Bartsch 60
4 10:34:57 different from my previous Christopher Cheng 77
5 10:32:50 small optimizations Jason Friedman 87
6 10:26:12 randperm Alex Backer 89
7 10:25:41 hello jed pack 90
8 10:21:49 first2 Laszlo Sragner 92
9 10:19:17 freq Emmanuel Lange 98
10 10:19:06 freqsort 2 Alex Backer 103
11 10:15:04 freqsort walter kuhn 109
12 10:14:52 Chris's Entry Christopher CHeng 144


 golf_1_frequencies
 
Home

Rules

This hole (closed)

     The challenge

     Show all entries

     Search for an entry

Message board

Hall of fame

Send us feedback