[Java] Clean Solution
Just to remember which boxes have balls, then you move balls whereever you would like to move. List l \nis the indice of balls. \n\n    public int[] minOperatio
Just to remember which boxes have balls, then you move balls whereever you would like to move. List<Integer> l \nis the indice of balls. \n```\n    public int[] minOperations(String boxes) {\n        List<Integer> l = new ArrayList<>();\n        char[] c = boxes.toCharArray();\n        for (int i = 0; i < c.length; i++) {\n            if (c[i] == \'1\') l.add(i);\n        }\n        int[] res = new int[c.length];\n        for (int i = 0; i < c.length; i++) {\n            for (int j : l) {\n                res[i] += Math.abs(j - i);\n            }\n        }\n        return res;\n    }\n```
[]