• + 0 comments

    Here is a scala implementation

     def mingleStrings(s1:String,s2:String) :String =  {
            val n = s1.length()
            val sb = new StringBuilder("")
            def build(i:Int,accumulator:sb.type) :String = {
                if(i==n){
                    return accumulator.toString
                }
                accumulator+=s1.charAt(i)
                accumulator+=s2.charAt(i)
                return build(i+1,accumulator)
            }
            return build(0,sb) 
        }