Remove White Spaces from a String
Given a null-terminated string, remove all the white spaces.
We'll cover the following...
We'll cover the following...
Statement
Given a null-terminated string, remove all the white spaces (tabs or spaces) present in the string.
Example:
Sample input
All greek to me.
Expected output
Allgreektome.
Let’s visualize this below:
Try it yourself #
Solution
This problem can be solved with two pointers. Here is an overview:
- Initialize
readandwritepointers to the start of the string. - With the