title: Number Of Substrings With Odd Decimal Value In A Binary String
signature: class Solution {
  
      public Integer numberOfSubstringsWithOddDecimalValueInABinaryString(String s) {
test_code: import static java.util.Map.entry;  
  import java.util.*;
  import java.lang.*;
  // TESTING CODE 
  // ============================================
  class QuestionEvaluator {
      public static String validateSolution(String s, Integer expected){
          try{
              Driver driver = new Driver();
              if (driver.run(s,expected)){
                  return "PASSED";
              }
              return "FAILED";
              
          } catch (Exception exception_obj){
              return exception_obj.getClass().getSimpleName();
          }
  
      }
      public static void main(String[] args) {
          String result;
          result = validateSolution("OGiOkJF", 0);
          System.out.println(String.format("%s%s","TEST-0...",result));    
      
          result = validateSolution("517376", 1);
          System.out.println(String.format("%s%s","TEST-1...",result));    
      
          result = validateSolution("11", 3);
          System.out.println(String.format("%s%s","TEST-2...",result));    
      
          result = validateSolution("Ze", 0);
          System.out.println(String.format("%s%s","TEST-3...",result));    
      
          result = validateSolution("8763644247018", 1);
          System.out.println(String.format("%s%s","TEST-4...",result));    
      
          result = validateSolution("00111010001", 15);
          System.out.println(String.format("%s%s","TEST-5...",result));    
      
          result = validateSolution("HGwkBKUOVu", 0);
          System.out.println(String.format("%s%s","TEST-6...",result));    
      
          result = validateSolution("652", 0);
          System.out.println(String.format("%s%s","TEST-7...",result));    
      
          result = validateSolution("101000011110", 21);
          System.out.println(String.format("%s%s","TEST-8...",result));    
      
          result = validateSolution("kvdpG ", 0);
          System.out.println(String.format("%s%s","TEST-9...",result));    
      
      }
  }
  
  class Driver{
      public boolean run(String s, Integer expected){
  
          PLACEHOLDER_CLS_NAME sol = new PLACEHOLDER_CLS_NAME();
          return validateSolution(sol.PLACEHOLDER_FN_NAME(s),expected);
      }
      
      public boolean validateSolution(Integer actual, Integer expected){
          return actual.equals(expected);
      }
  }
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
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;
    }