Discover MakerZone

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

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Problem 2153. Replace pattern 0 1 0 and 1 0 1

Created by Anette

Find and replace a pattern in a row of zeroes and ones.

  • Find 1 0 1 and replace it with 1 1 1
  • Find 0 1 0 and replace it with 0 0 0

Example:

 Input : [ 1 1 1 0 1 1 0 0 0 1 0 0 0 ]
 Output: [ 1 1 1 1 1 1 0 0 0 0 0 0 0 ]

Problem Group

Solution Statistics

21 correct solutions 4 incorrect solutions
Last solution submitted on Aug 20, 2014

Solution Comments