1528. Shuffle String | Array & ZIP | Python

Publié le: 27 juin 2025
sur la chaîne: Soupzzz
28
1

🧩 Leetcode: Restore String | Python Solution Explained 🧠
In this video, we solve the "Restore String" problem using a simple and efficient Python approach.
We take each character from the input string and place it in the correct position using the given indices array.

⚙️ Time Complexity: O(n)
🧵 Concepts Used: Lists, Zip, String Manipulation

💡 Code:

class Solution:
def restoreString(self, s: str, indices: List[int]) - str:
res = ['x'] * len(s)
for l, i in zip(s, indices):
res[i] = l
return ''.join(res)

🔔 Don't forget to like, subscribe, and drop a comment if this helped!
#leetcode #python #codingchallenge #dsa


Sur cette page du site, vous pouvez voir la vidéo en ligne 1528. Shuffle String | Array & ZIP | Python durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Soupzzz 27 juin 2025, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 28 fois et il a aimé 1 téléspectateurs. Bon visionnage!