-1
$\begingroup$

So I saw this very interesting problem. Let's say you have a length of 2, and a base length of 5

l = 2, b = 5

this would be translated to :

11000

Now if you give an input let's say a 2 the ones on the problem above should move by this number. :

11000 → input 2 : 10100

So the pattern is like this :

input: 1 → 11000
input: 2 → 10100
input: 3 → 10010
input: 4 → 10001
input: 5 → 01100
input: 6 → 01010
input: 7 → 01001
input: 8 → 00110
input: 9 → 00101
input: 10 → 00011

input = 10 would be the final number

So the problem is what if you have an l equals to 8 and b equals to 50 :

11111111000000000000000000000000000000000000000000

And you're looking for a pattern something like :

00000010000000011000000000010010000000110000000010

How would this problem be solved without an absurdly large number, is this possible?

$\endgroup$
1
  • 3
    $\begingroup$ I have essentially no idea what any part of the question is supposed to mean. For example what do you mean by "if you have l=..., b=..., this should be translated to to 11000". What exactly are the rules for coming up with that latter number? For example, is it supposed to be a bit pattern of some sort, or is the translation that you do $l*b*1100$? The remainder of the question is equally unclear ("should move by this number", "so the problem is what if" -- what actually is the problem that you're trying to solve, and what is "an absurdly large number"?). $\endgroup$ Aug 8, 2022 at 16:49

1 Answer 1

1
$\begingroup$

Biologist here - so take the answer with a grain of salt. But my guess is that you can reduce the complexity of this problem by looking for partial solutions. What this partial solution might look like would depend on the context - i.e. what constitutes a "closer" approximation to the final solution.

For a simple example; $l=10$, $b=500$ problem.

If in a given context, a partial solution can be determined to be closer to the final answer if a particular base position is correctly identified, then I would iterate through each position in the list, trying 1 or 0. If I improve the partial solution then I would move to the next position. In this situation, I would only have to try a maximum $2 \times 500$ solutions before exhausting my options.

In other scenarios, the definition of a partial solution might change, and therefore the number of possible partial solutions you would have to iterate through would be different.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.