# Is it possible to decode an array stored in strings with constraint satisfaction?

I am currently experimenting on compression algorithms, I am using proven algorithms and I am just trying to see if I can make some things more efficient, so I am very sorry if this is a stupid question. I am trying to decode an array from a string for example I have [123, 4, 12, 7, 51] so if I turn this into a string it would be "123412751" are there ways to decode this without bloating the array? like you can keep the length of this by doing something like 31231421217251 so you'd know how to decode this but the problem is you'd bloat the data needed so instead I would like to know if this is solvable with constraint satisfaction and how would I go about that?

What I did with constraint satisfaction is I'd get the sum of [123, 4, 12, 7, 51] which is 197 and the length needed which is 5 so now I'd look for combinations from "123412751" with a length of 5 and a sum of 197 however with larger arrays it gives me different values not really the exact one I needed, is this something that is possible?

• What do you mean by "with constraints"? Please edit your question to clarify what you are asking.
– D.W.
Sep 21, 2022 at 5:56
• Sorry I meant "constraint satisfaction" Sep 21, 2022 at 6:24
• experimenting on compression algorithms algorithms solve problems. Compression algorithms turn original data into something smaller (cheaper to keep/transfer) that can be decompressed into something useful - the original if lossless. A useful algorithm allows implementation with non-prohibitive resource requirements - combinations reminds of combinatorial explosion: Not everything possible is feasible. Sep 21, 2022 at 6:44
• So what happens if you have a 10 digit number? Sep 21, 2022 at 7:18