This question is mostly asked in a product based company to check the concept of string, and in this video, we will see how can we solve it.
A common approach in string manipulation problems is to edit the string starting from the end and working backwards. This is useful because we have an extra buffer at the end, which allows us to change the character without worrying about what we're overwriting.
We will use this approach to this problem. The algorithm employs a two scan approach. In this first scan, we count the number of spaces. By tripling this number, we can compute how many extra characters we will have in the final string. In the second pass, which is done in reverse order, we actually edit the string. When we see a space, we replace t with %20. If there is no space then we copy the original character
Auf dieser Seite können Sie das Online-Video Cracking The Coding Interview |URLify The Given String | Competitive Programming | Array Problem mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Pawan S Nair 26 September 2020 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 5,113 Mal angesehen und es wurde von 108 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!