Counting Sequence - MATLAB Cody - MATLAB Central

Problem 55. Counting Sequence

Difficulty:Rate

Given a vector x, find the "counting sequence" y.

A counting sequence is formed by "counting" the entries in a given sequence.

For example, the sequence

 x = 5, 5, 2, 1, 1, 1, 1, 3

can be read as

 Two 5's, one 2, four 1's, one 3

which translates to

 y = 2, 5, 1, 2, 4, 1, 1, 3

So y is the counting sequence for x.

For this problem, all elements in the sequences x and y will be in the range from 1 to 9.

Solution Stats

48.94% Correct | 51.06% Incorrect
Last Solution submitted on May 09, 2025

Problem Comments

Solution Comments

Show comments
PIVlab surpasses 100K all-time File Exchange downloads
During the past twelve months, PIVlab, a MATLAB Community Toolbox for particle...
4
8
LLMs with MATLAB updated to support the latest OpenAI Models
Large Languge model with MATLAB, a free add-on that lets you access...
2
4

Problem Recent Solvers2089

Suggested Problems

More from this Author96

Problem Tags

Community Treasure Hunt

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

Start Hunting!