D
D
Dmitry2020-03-03 19:14:04
Algorithms
Dmitry, 2020-03-03 19:14:04

How to perform convolution of combinations?

I have a set of unique combinations of 3 numbers from different numbers from 1 to 100. Is there an algorithm for finding such sets of series of numbers that, when decomposed into combinations, will give the original set? Example:
Given:
1 2 3
1 2 4
1 3 4
2 3 4
Answer: 1 2 3 4
We need to find a set of new rows that minimizes the number of records.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
W
Wataru, 2020-03-03
@wataru

The task is formulated in a strange way, but it seems that you just need to find all the unique numbers in the input.
Either use some set, or add all the input numbers into an array, sort and then remove consecutive elements repeating in a row.

D
Dmitry, 2020-03-04
@Maalox

No, not unique numbers.
There is a simple function that receives a string of numbers (for example, 7 different numbers in the range from 1 to 100), at the output it produces many combinations of 3 numbers - a total of 35 elements.
And I need an inverse function - by a set of combinations (no more than 10,000 elements) to determine from which rows of numbers this set can be obtained. It's kind of like reversible hashing, I guess.
While thoughts stop at counting the number of connections between all the numbers in the set

X
xmoonlight, 2020-03-28
@xmoonlight

1 5 17
1 5 22
1 5 23
1 17 23
5 17 23
And the answer will be 2 rows:
1 5 17 23
1 5 22

1. Two or more identical numbers in one vertical column (1-1-1-1, 5-5-5, 17-17, 23-23-23) - put in one common set: 1 5 17 23.
2 We remove all combinations that contain any 3 digits from the total set.
3. Only unique lines remain (1 5 22): exactly unique combinations. We just add them separately.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question