Problem 3053. stem and leaf plot
A stem-and-leaf display is a device for presenting quantitative data in a graphical format, similar to a histogram, to assist in visualizing the shape of a distribution.
Example
Given some series of numbers like this
12 15 14 23 24 26 28 33 38 39
you should convert it this one
1 | 245 2 | 3468 3 | 389
input is {'12','15','14','23','24','26','28','33','38','39'}
output will be {'1245','23468','3389'}
Note: input numbers must be sorted increasing order.
Solution Stats
Problem Comments
-
3 Comments
Hi, nice problem. It would be more interesting if you create a test condition with varying length and varying level of sub-string similarity. For example, {'1','2','1111','1112','1113','1121','1122','11111'} etc. That would force people to come up with a nice recursive algorithm.
Hi @rifat I am plesure that you like my problem also thanks for your recommendation I think that will be second questions
The problem description needs to specify the solution/output order or accept it in any order: I had to sort it in accordance with similarity-length (if someone is wondering). And I liked your problem, but I had to infer many aspects of it from the test suite. It is not clear by the problem description alone that the similarity-length may be greater than one.
Solution Comments
Show commentsProblem Recent Solvers17
Suggested Problems
-
Back to basics 22 - Rotate a matrix
895 Solvers
-
Sum of diagonal of a square matrix
1565 Solvers
-
I've got the power! (Inspired by Project Euler problem 29)
118 Solvers
-
Basics: Divide integers to get integer outputs in all cases
132 Solvers
-
558 Solvers
More from this Author21
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!