LeetCode 541 | Reverse String II | Algorithm Explained (Java)

Publié le: 15 août 2020
sur la chaîne: Xavier Elon
6,839
84

The description reads:
"Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there are less than k characters left, reverse all of them. If there are less than 2k but greater than or equal to k characters, then reverse the first k characters and left the other as original.
Input: s = "abcdefg", k = 2
Output: "bacdfeg"
"

Running Time: O(N)
Space Complexity: O(N)

FOLLOW ME:
Slack Channel: https://join.slack.com/t/xavierelonle...
Github: https://github.com/xavierelon1
Facebook:   / xavier.hollingsworth.3  
Instagram:   / xavierelon  
LinkedIn:   / xavier-hollingsworth-524144127  
Twitter:   / elon_xavier  


Sur cette page du site, vous pouvez voir la vidéo en ligne LeetCode 541 | Reverse String II | Algorithm Explained (Java) durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Xavier Elon 15 août 2020, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 6,839 fois et il a aimé 84 téléspectateurs. Bon visionnage!