title: Count Numbers That Dont Contain 3
signature: pub fn count_numbers_that_dont_contain_3(n: i32) -> f64 {
test_code: use std::collections::HashMap;
  use std::collections::HashSet;
  use std::cmp::*;
  use std::collections::*;
  use std::fmt::*; 
  
  
  // SOLUTION CODE
  // ============================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE 
  // ============================================
  pub fn validate_solution(actual: f64, expected: f64)->bool{
  return (actual - expected).abs() < 1e-09
  }
  pub fn driver(n: i32, expected: f64)->String{
      if validate_solution(PLACEHOLDER_FN_NAME(n), expected) {
        return "PASSED".to_string();
      };
      return "FAILED".to_string();
  
  }
  
  fn main() {
      println!("TEST-0...{}", driver(
        85, 
        71.5
      ));
      
      println!("TEST-1...{}", driver(
        86, 
        73.39999999999999
      ));
      
      println!("TEST-2...{}", driver(
        3, 
        2.0
      ));
      
      println!("TEST-3...{}", driver(
        35, 
        26.5
      ));
      
      println!("TEST-4...{}", driver(
        59, 
        52.1
      ));
      
      println!("TEST-5...{}", driver(
        38, 
        32.2
      ));
      
      println!("TEST-6...{}", driver(
        33, 
        22.7
      ));
      
      println!("TEST-7...{}", driver(
        15, 
        17.5
      ));
      
      println!("TEST-8...{}", driver(
        75, 
        62.5
      ));
      
      println!("TEST-9...{}", driver(
        74, 
        60.6
      ));
      
  }
source_py: def count_numbers_that_dont_contain_3(n):
      if (n < 3):
          return n
      elif ((n >= 3) and (n < 10)):
          return (n - 1)
      po = 1
      while ((n / po) > 9):
          po = (po * 10)
      msd = (n / po)
      if (msd != 3):
          return (((count_numbers_that_dont_contain_3(msd) * count_numbers_that_dont_contain_3((po - 1))) + count_numbers_that_dont_contain_3(msd)) + count_numbers_that_dont_contain_3((n % po)))
      else:
          return count_numbers_that_dont_contain_3(((msd * po) - 1))
source_cpp: int count_numbers_that_dont_contain_3(int n) {
    if ( n < 3 ) return n;
    if ( n >= 3 && n < 10 ) return n - 1;
    int po = 1;
    while ( n / po > 9 ) po = po * 10;
    int msd = n / po;
    if ( msd != 3 ) return count_numbers_that_dont_contain_3 ( msd ) * count_numbers_that_dont_contain_3 ( po - 1 ) + count_numbers_that_dont_contain_3 ( msd ) + count_numbers_that_dont_contain_3 ( n % po );
    else return count_numbers_that_dont_contain_3 ( msd * po - 1 );
  }