Two Lines Only - Functional Approach
This code hard to understand. It is a challenge for you to explain it.Please, do not write code like this in your production.
This code hard to understand. It is a challenge for you to explain it.

Please, do not write code like this in your production.


```javascript []
var minimumOperations = f = (root, n = [root]) => 
    n.length ? swaps(n.map($=>$.val)) + f(0, n.map(n => [n.left, n.right]).flat().filter($=>$)) : 0;

const swaps = (l, s = [...l].sort((a, b) => a - b)) =>
    s.reduce((o,O,i,_,I=l.indexOf(O)) => ([l[i],l[I]] =[l[I],l[i]],o+(i!==I)), 0);

```
['JavaScript']