solutionbut subtler solutions that use the string itself to reduce space complexity to ( understand the implications of string type which is immutablee the need to allocate new string when concatenating immutable strings know alternatives to immutable stringse list in python updating mutable string from the front is slowso see if it' possible to write values from the back table top tips for strings implementations of python use tricks under-the-hood to avoid having to do this allocationreducing the complexity to ( interconvert strings and integers string is sequence of characters string may encode an integere " encodes in this problemyou are to implement methods that take string representing an integer and return the corresponding integerand vice versa your code should handle negative integers you cannot use library functions like stoi in ++parseint in javaand int in python implement string/integer inter-conversion functions hintbuild the result one digit at time solutionlet' consider the integer to string problem first if the number to convert is single digiti it is between and the result is easy to computeit is the string consisting of the single character encoding that digit if the number has more than one digitit is natural to perform the conversion digit-by-digit the key insight is that for any positive integer xthe least significant digit in the decimal representation of is mod and the remaining digits are / this approach computes the digits in reverse ordere if we begin with we get and are left with to convert then we get and are left with to convert finallywe get and there are no digits to convert the natural algorithm would be to prepend digits to the partial result howeveradding digit to the beginning of string is expensivesince all remaining digit have to be moved more time efficient approach is to add each computed digit to the endand then reverse the computed sequence if is negativewe record thatnegate xand then add '-before reversing if is our code breaks out of the iteration without writing any digitsin which case we need to explicitly set to convert from string to an integer we recall the basic working of positional number system base- number encodes the number brute-force algorithm then is to begin with the rightmost digitand iteratively add di to cumulative sum the efficient way to compute + is to use the existing value and multiply that by more elegant solution is to begin from the leftmost digit and with each succeeding digitmultiply the partial result by and add that digit for exampleto convert " to an integerwe initial the partial result to in the first iterationr in the second iteration and in the third iteration which is the final result negative numbers are handled by recording the sign and negating the result