Skip to content

Instantly share code, notes, and snippets.

@inhacker
Created March 27, 2016 02:43
Show Gist options
  • Save inhacker/af44b78776e12047d0b9 to your computer and use it in GitHub Desktop.
Save inhacker/af44b78776e12047d0b9 to your computer and use it in GitHub Desktop.
Markdown Q4
##Description
Write a method to replace all spaces in a string with %20. You may assume that the string has sufficient space at the end of the string to hold the additional characters, and that you are given the true length of the string. (Note: If implementing in Java, please use a character array so that you can perform this operation in place.)
##Git Branch
https://github.com/loliplus/MOMOKO_KAWAII/tree/Question_01_04
##Test Cases
| Test Case Input | Expected Output |
|----------------------------------------------- |----------------- |
| "Mr John Smith " | "Mr%20John%20Smith" |
| "A " | "A" |
| " B" | "B" |
| " C " | "C" |
| "A B C D" | "A%20B%20C%20D" |
| " " | "" |
| "" | "" |
Table generated using [Markdown Tables Generator](http://www.tablesgenerator.com/markdown_tables)
##Solutions
###Solution 0
Using C
>
####Description:
####Limitation:
O(n)
####Related files:
[`replace_space.c`] (https://github.com/loliplus/MOMOKO_KAWAII/blob/Question_01_04/akamigishi/replace_space.c) (C, akamigishi)
>
###Solution 1
Using Python
>
####Description:
看了下 要在 py 里按照答案做没啥太大的意义就这样吧
####Limitation:
O(C)
####Related files:
[`solution1.py`] (https://github.com/loliplus/MOMOKO_KAWAII/blob/Question_01_04/xikitempula/solution1.py) (python, xikitempula)
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment