---
# System prepended metadata

title: Oscar Lim

---


# Oscar Lim

# Question 1
```
Given an array of random positive numbers, move all the zeroes to the left of the array. 

Conditions: 
1) has to be done in place ( space-constrained, ie. cannot allocate a new array)
2) the order of non-zero elements on the right do not matter

Input :  arr[] = {i>0, 1, 2, 5, k>0, 3, 0, 3}; 
Output : arr[] = {0, 0, 0, 2, 1, 3, 3, 5};
```

```javascript
// Write your solution here
let i = 0;
let a = 0;
arr.forEach((v,k) => {
   if(arr[k] === 0) {
       a = arr[k];
       arr[i] = arr[k];
       arr[k] = a;
       i++;
   }
});


```

# Question 2
```
//        1 <---- root
//     /     \
//    2       3
//   / \     / \
//  4   5   6   7
//8  9  
//
// 1) create the node type
// 2) write a function to print tree by level 
// ie. print "1","2","3","4","5","6","7"....
```



```javascript / ruby / go / python
// Write your solution here
class Node {
    value : String
    left  : Node
    right : Node
}



function printTreeByLevel(root: Node) {
    root.value = 
}























```

