Skip to main content
5 of 6
added 85 characters in body

How to efficiently replace the repetitive sequence?

The problem is how to determine the repetitive sequences and replace the part with consecutive sequences For example: A={{1,3,4},{2,3,5},{1,6}} Then, detect there are the repetitive case for 1 and 3 and become A={{1,4,6},{3,5,7},{2,8}}

Updates

Q1:How can I assign the repetitive sequences in lists(transpose tableform) with the rules:

-Highest level & no blocked on the top will be assigned lower number.

-High level with similar repetition will follow later.

-The one underneath the other number will be much later. enter image description here For example:Input

A={{2,1},{2,2},{1,2},{1},{2,1,1}};
Print[Rotate[
  Grid[Map[Rotate[#, -90 Degree] &, A, {-1}], Frame -> All], 
  90 Degree]]

enter image description here

And implement the rules to get the output:

enter image description here

Q2:How can I generate all the possible list outcomes without the rules when the lists have repetitive cases?