title: Number Of Substrings With Odd Decimal Value In A Binary String
signature: class Solution {
  
      public int NumberOfSubstringsWithOddDecimalValueInABinaryString(string s) {
test_code: using System;
  using System.Numerics;
  using System.Diagnostics;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.Security.Cryptography;
  using System.Web.UI;
  using System.Web.Script.Serialization;
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  namespace EvaluatePrediction {
      class TestRunner {
          public bool ValidateSolution(int actual, int expected){
              return new JavaScriptSerializer().Serialize(actual) == new JavaScriptSerializer().Serialize(expected);
          }
  
          public string driver(string s, int expected){
              try{
                PLACEHOLDER_CLS_NAME solution_cls = new PLACEHOLDER_CLS_NAME();
                int pred_result = solution_cls.PLACEHOLDER_FN_NAME(s); 
                if (ValidateSolution(
                      pred_result,
                      expected)){
                  return "PASSED";
                }
                return "FAILED";
              } 
              catch (Exception exception_obj)
              {
                return exception_obj.GetType().FullName;
              }
          }
          static void Main(string[] args) {
              TestRunner runner = new TestRunner();
              String result;
              result = runner.driver(
                  "OGiOkJF", 
                  0
              );
              Console.WriteLine(string.Format(
                  "TEST-0...{0}",
                  result)
              );result = runner.driver(
                  "517376", 
                  1
              );
              Console.WriteLine(string.Format(
                  "TEST-1...{0}",
                  result)
              );result = runner.driver(
                  "11", 
                  3
              );
              Console.WriteLine(string.Format(
                  "TEST-2...{0}",
                  result)
              );result = runner.driver(
                  "Ze", 
                  0
              );
              Console.WriteLine(string.Format(
                  "TEST-3...{0}",
                  result)
              );result = runner.driver(
                  "8763644247018", 
                  1
              );
              Console.WriteLine(string.Format(
                  "TEST-4...{0}",
                  result)
              );result = runner.driver(
                  "00111010001", 
                  15
              );
              Console.WriteLine(string.Format(
                  "TEST-5...{0}",
                  result)
              );result = runner.driver(
                  "HGwkBKUOVu", 
                  0
              );
              Console.WriteLine(string.Format(
                  "TEST-6...{0}",
                  result)
              );result = runner.driver(
                  "652", 
                  0
              );
              Console.WriteLine(string.Format(
                  "TEST-7...{0}",
                  result)
              );result = runner.driver(
                  "101000011110", 
                  21
              );
              Console.WriteLine(string.Format(
                  "TEST-8...{0}",
                  result)
              );result = runner.driver(
                  "kvdpG ", 
                  0
              );
              Console.WriteLine(string.Format(
                  "TEST-9...{0}",
                  result)
              );
          }
      }
  }
  
source_py: def number_of_substrings_with_odd_decimal_value_in_a_binary_string(s):
      n = len(s)
      auxArr = [0 for i in range(n)]
      if (s[0] == '1'):
          auxArr[0] = 1
      for i in range(0, n):
          if (s[i] == '1'):
              auxArr[i] = (auxArr[(i - 1)] + 1)
          else:
              auxArr[i] = auxArr[(i - 1)]
      count = 0
      for i in range((n - 1), (- 1), (- 1)):
          if (s[i] == '1'):
              count += auxArr[i]
      return count
source_cpp: int number_of_substrings_with_odd_decimal_value_in_a_binary_string(string s) {
    int n = s . length ( );
    int auxArr [ n ] = {
      0 };
      if ( s [ 0 ] == '1' ) auxArr [ 0 ] = 1;
      for ( int i = 1;
      i < n;
      i ++ ) {
        if ( s [ i ] == '1' ) auxArr [ i ] = auxArr [ i - 1 ] + 1;
        else auxArr [ i ] = auxArr [ i - 1 ];
      }
      int count = 0;
      for ( int i = n - 1;
      i >= 0;
      i -- ) if ( s [ i ] == '1' ) count += auxArr [ i ];
      return count;
    }