the first solution which gets ac , also recur for all the four case , and my 2nd solution also recur for all four cases .
But why i am getting tle at TC 6 , is there something i am missing , or something which is increasing the time complexity of 2nd sol.