August 13, 2024 |19.3K 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/