"Crushed LeetCode! 💥 Solved the Daily Challenge with a Top Score! 😎"
💡 #Intuition
When I first saw the problem, I thought about how to efficiently calculate the number of moves needed to transfer all the balls to each box. Instea
 
💡 **#Intuition**  
When I first saw the problem, I thought about how to efficiently calculate the number of moves needed to transfer all the balls to each box. Instead of recalculating for every box, I came up with a two-step approach: one pass from left to right and another from right to left. This way, I could gather the necessary information and compute the result smartly and efficiently.  

🚀 **#Approach**  
The solution involves two passes:  
1️⃣ **Left to Right:** Count the balls up to each point and add the required moves.  
2️⃣ **Right to Left:** Calculate the additional moves from the other direction and combine them into the result.  

✨ The result is an efficient calculation that returns the number of moves needed for each box in a single array.  

⏱ **#Complexity**  
- **Time Complexity:** $$O(n)$$  
   Just two passes over the string.  
- **Space Complexity:** $$O(n)$$  
   One array for the result.  

💻 **#Code**  
```java
class Solution {
    public int[] minOperations(String boxes) {
        int n = boxes.length();
        int[] operations = new int[n];
        
        int count = 0; 
        int steps = 0; 
        for (int i = 0; i < n; i++) {
            operations[i] += steps;
            if (boxes.charAt(i) == '1') {
                count++;
            }
            steps += count;
        }
        
        count = 0; 
        steps = 0; 
        for (int i = n - 1; i >= 0; i--) {
            operations[i] += steps;
            if (boxes.charAt(i) == '1') {
                count++;
            }
            steps += count;
        }
        
        return operations;
    }
}
```

---

🎉 **My highest LeetCode score ever!**  
If you're looking to improve your skills in dynamic programming or efficient algorithm design, this is a great problem to tackle.  
What do you think about my approach? I’d love to hear your thoughts or alternative ideas! 👇
['Java']