We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
importredefsolve(matrix,n,m):string=""# Here I use zip which transposes the matrix; that means it converts rows into columns# You can also use numpy# Using nested loops is not ideal in Python, so zip is used to avoid thatmatrix_T=list(zip(*matrix))foriinmatrix_T:string+="".join(list(i))clear=re.sub(r'(?<=[a-zA-Z0-9_])[!@#$%&" "]+(?=[a-zA-Z0-9_])',' ',string)print(clear)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Matrix Script
You are viewing a single comment's thread. Return to all comments →