Scala O(n)  A very easy solution
Intuition: To achieve the transformation, the only thing we need to make sure is that the elements of descending subarray in t should keep their order in s, bec
Intuition: To achieve the transformation, the only thing we need to make sure is that the elements of descending subarray in `t` should keep their order in `s`, because we cannot transform ascending subarray to a descending subarray.\n\n```\nimport scala.collection.mutable\n\n\nobject Solution {\n  def isTransformable(s: String, t: String): Boolean = {\n    val sIndexes = Array.fill(10)(mutable.ArrayBuffer[Int]())\n    s.indices.foreach(i => {\n      val x = s(i).toString.toInt\n      sIndexes(x).append(i)\n    })\n\n    val tProgress = Array.fill(10)(0)\n    t.indices.foreach(i => {\n      val n = t(i).toString.toInt\n      tProgress.update(n, tProgress(n) + 1)\n\n      if (sIndexes(n).length < tProgress(n)) {\n        return false\n      }\n\n      if (i > 0 && t(i) < t(i-1)) {\n        // make sure the order is right\n        val a = n\n        val b = t(i-1).toString.toInt\n        if (sIndexes(a)(tProgress(a)-1) < sIndexes(b)(tProgress(b)-1)) {\n          return false\n        }\n      }\n    })\n\n    true\n  }\n}\n```
[]