August 13, 2024 |17.2K Views

Camel case of a given sentence

  Share   Like
Description
Discussion

Simple solution: First method is to traverse sentence and one by one remove spaces by moving subsequent characters one position back and changing case of first character to capital. It takes O(n*n) time.


Efficient solution : We traverse given string, while traversing we copy non space character to result and whenever we encounter space, we ignore it and change next letter to capital.


Camel case of a given sentence : https://www.geeksforgeeks.org/camel-case-given-sentence/