Finding $x_1,x_2,...,x_k$ such that $n=x_1!+x_2!+...+x_k!$ and $k$ is minimal Here is a problem I'm trying to solve:

Given an integer $n$ return a list $[x_1,x_2,...,x_k]$ such that $n=x_1!+x_2!+...+x_k!$ and $k$ is as low as it can be.

I'm thinking of creating a list of n ones, then pairing them as long as I can (so for example $[1,1,1,1,1]$ becomes $[2,2,1]$) then I want to exchange all triples of $[2,2,2]$ to one $3$ (because $2!+2!+2!=3!$) and so on...

Intuitively this should be correct, and also quite fast - the input on which I'm executing my "concatenations" shrinks as fast as factorial function grows...

But is my method correct? And also if I were to find complexity of my algorithm in terms of $n$, how should I do that? One more thing, maybe there is simpler way to solve this algorithmic problem - any ideas?
Your algorithm is correct and its running time is in $\Theta(n)$ which is exponential to the input size. But we can use simple greedy algorithm to achive $O(\log n)$. Find largest number $i$ such that $i! \le n$. To do so just simply iterate through numbers in $1,\cdots, \log n +1$. And do the same for $n -i!$.