I need to merge two numbers and create all possible outcomes.
Lets say we have a = 45 and b = 766, we are looking for such numbers **45**766, **4**7**5**66, **4**76**5**6 and so on, In a way that the original numbers stay in the same order (we can't do **54**766).
I can use only math to solve this. Can you name any method or path of thinking to achieve this goal?
aandbto string. Concatenate the string. Apply some logic to generate those permutations. Then convert the string result back to int.aandbusing multiplication, division and modulo operators.45 * 1000 + 766 = 45766.45 modulo 10 = 5, 45 / 10 = 4, 4 * 10000 + 766 * 10 + 5 = 47665. Something like that.