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
En esta página del sitio puede ver el video en línea Cracking The Coding Interview |URLify The Given String | Competitive Programming | Array Problem de Duración hora minuto segunda en buena calidad , que subió el usuario Pawan S Nair 26 septiembre 2020, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 5,113 veces y le gustó 108 a los espectadores. Disfruta viendo!