title: Check If A Number Is Jumbled Or Not
signature: func checkIfANumberIsJumbledOrNot(num int) bool {
test_code: package main
  
  import (
      "fmt"
      "reflect"
      "math"
      "sort"
  )
  
  // SOLUTION CODE
  // ===================================
  PLACEHOLDER_CODE_BODY
  
  // TESTING CODE
  // ===================================
  func validateSolution(actual bool, expected bool) bool {
      return reflect.DeepEqual(actual,expected)
  }
  
  func driver(num int, expected bool) string {
      if validateSolution(PLACEHOLDER_FN_NAME(num),expected) {
              return "PASSED"
      }
      return "FAILED"
  
  }
  
  func main() {
  
      // Use imports to avoid undefined errors
      var _ = reflect.DeepEqual
      _ = math.Abs
      _ = sort.Sort
      result := ""
      result = driver(67, true)
      fmt.Printf("TEST-0...%s\n", result)
      
      result = driver(77, true)
      fmt.Printf("TEST-1...%s\n", result)
      
      result = driver(35, false)
      fmt.Printf("TEST-2...%s\n", result)
      
      result = driver(79, false)
      fmt.Printf("TEST-3...%s\n", result)
      
      result = driver(45, true)
      fmt.Printf("TEST-4...%s\n", result)
      
      result = driver(22, true)
      fmt.Printf("TEST-5...%s\n", result)
      
      result = driver(68, false)
      fmt.Printf("TEST-6...%s\n", result)
      
      result = driver(17, false)
      fmt.Printf("TEST-7...%s\n", result)
      
      result = driver(5, true)
      fmt.Printf("TEST-8...%s\n", result)
      
      result = driver(85, false)
      fmt.Printf("TEST-9...%s\n", result)
      
          
  }
source_py: def check_if_a_number_is_jumbled_or_not(num):
      if ((num // 10) == 0):
          return True
      while (num != 0):
          if ((num // 10) == 0):
              return True
          digit1 = (num % 10)
          digit2 = ((num // 10) % 10)
          if (abs((digit2 - digit1)) > 1):
              return False
          num = (num // 10)
      return True
source_cpp: bool check_if_a_number_is_jumbled_or_not(int num) {
    if ( num / 10 == 0 ) return true;
    while ( num != 0 ) {
      if ( num / 10 == 0 ) return true;
      int digit1 = num % 10;
      int digit2 = ( num / 10 ) % 10;
      if ( abs ( digit2 - digit1 ) > 1 ) return false;
      num = num / 10;
    }
    return true;
  }