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 ]

Solution Stats

325 Solutions

162 Solvers

Last Solution submitted on Sep 17, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Problem Recent Solvers162

Suggested Problems

More from this Author1

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!