Amazon | SDE | 25 November

Amazon · Question · Posted Apr 2020

Write a method to replace all the spaces in a string with percent20. You may assume that the string has sufficient space at the end to hold the additional characters, and that you are given the true length of the string. Input : "Mr John Smith", 13 Output : Mr%20John%20Smith Input : "Mr John Smith ", 13 Output : Mr%20John%20Smith

The full answer & interview discussion are available to premium members.

Log in Create a free account