title: Search Insert And Delete In An Unsorted Array
signature: search_insert_and_delete_in_an_unsorted_array <- function(arr, n, key) {
test_code: 
  
  
  # SOLUTION CODE
  # ============================================
  PLACEHOLDER_CODE_BODY
  
  # TESTING CODE 
  # ============================================
  validate_solution <- function(actual, expected) {
      toString(actual)==toString(expected)
  }
  
  driver <- function(arr, n, key, expected){
      if (validate_solution(PLACEHOLDER_FN_NAME(arr, n, key), expected)){
          "PASSED"
      } else{
          "FAILED"
      }
  }
  
  main <- function() {
      cat(sprintf("TEST-0...%s\n",driver(
          list(4L, 8L, 11L, 23L, 55L, 57L, 73L, 74L, 77L, 79L, 93L), 8L, 11L, 
          2L
      )))
  
      cat(sprintf("TEST-1...%s\n",driver(
          list(-88L, 12L, -62L, -66L, -24L, 18L, 12L, 22L, 94L, 30L, -50L, -42L, -94L, 18L, 76L, -6L, -48L, -68L, 48L, 36L, -78L, 52L, -82L, 76L, 2L, -44L, -10L, 88L), 27L, 12L, 
          1L
      )))
  
      cat(sprintf("TEST-2...%s\n",driver(
          list(0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), 11L, 0L, 
          0L
      )))
  
      cat(sprintf("TEST-3...%s\n",driver(
          list(33L, 9L, 93L, 70L, 81L, 70L, 56L, 66L, 72L, 81L, 74L, 32L, 71L, 72L, 3L, 81L, 70L, 22L, 82L, 2L, 75L, 18L, 90L, 29L, 48L), 24L, 72L, 
          8L
      )))
  
      cat(sprintf("TEST-4...%s\n",driver(
          list(-98L, -70L, -62L, -60L, -60L, -54L, -48L, -48L, -46L, -44L, -34L, -26L, -18L, -6L, 4L, 18L, 28L, 32L, 34L, 40L, 50L, 54L, 56L, 62L, 64L, 64L, 98L), 18L, 23L, 
          -1L
      )))
  
      cat(sprintf("TEST-5...%s\n",driver(
          list(1L, 1L, 1L, 1L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 1L, 0L, 0L, 1L, 1L, 0L, 1L, 1L, 0L, 0L, 1L), 17L, 16L, 
          -1L
      )))
  
      cat(sprintf("TEST-6...%s\n",driver(
          list(4L, 6L, 7L, 10L, 10L, 12L, 13L, 18L, 23L, 29L, 29L, 34L, 46L, 54L, 60L, 61L, 63L, 67L, 69L, 70L, 72L, 76L, 79L, 79L, 81L, 82L, 88L, 90L, 99L), 15L, 28L, 
          -1L
      )))
  
      cat(sprintf("TEST-7...%s\n",driver(
          list(94L, 34L, -60L, -74L, 86L, 80L, 68L, -48L, 78L, -62L, -98L, -44L, -44L, 92L, -94L, -86L, -36L, 12L, 84L, -90L, 52L, 42L, -42L, -66L, 88L, 76L, 66L), 21L, 16L, 
          -1L
      )))
  
      cat(sprintf("TEST-8...%s\n",driver(
          list(0L, 0L, 0L, 1L), 2L, 3L, 
          -1L
      )))
  
      cat(sprintf("TEST-9...%s\n",driver(
          list(76L, 59L, 38L, 83L, 38L, 93L, 27L, 11L, 17L, 80L, 26L, 28L, 35L, 53L, 88L, 10L, 9L, 75L), 12L, 13L, 
          -1L
      )))
  
  }
  
  main()
source_py: def search_insert_and_delete_in_an_unsorted_array(arr, n, key):
      for i in range(n):
          if (arr[i] == key):
              return i
      return (- 1)
source_cpp: int search_insert_and_delete_in_an_unsorted_array(vector<int> arr, int n, int key) {
    int i;
    for ( i = 0;
    i < n;
    i ++ ) if ( arr [ i ] == key ) return i;
    return - 1;
  }