Driver code
public static void Main ( ) { int [ ] arr = { 1 , 0 , 1 , 0 , 1 , 1 } ; int n = arr . Length ; int [ ] pre = new int [ n ] ; precompute ( arr , n , pre ) ; Console . WriteLine ( decimalOfSubarr ( arr , 2 , 4 , n , pre ) ) ; Console . WriteLine ( decimalOfSubarr ( arr , 4 , 5 , n , pre ) ) ; } }