Cracking The Coding Interview |URLify The Given String | Competitive Programming | Array Problem

Published: 26 September 2020
on channel: Pawan S Nair
5,113
108

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


On this page of the site you can watch the video online Cracking The Coding Interview |URLify The Given String | Competitive Programming | Array Problem with a duration of hours minute second in good quality, which was uploaded by the user Pawan S Nair 26 September 2020, share the link with friends and acquaintances, this video has already been watched 5,113 times on youtube and it was liked by 108 viewers. Enjoy your viewing!