Reverse words in a given string

Given a string, write a function that will print the words of a string in reverse order Example INPUT s = “tutorial cup makes programming easy” OUTPUT “easy programming makes cup tutorial” Time Complexity : O(n) Algorithm Traverse the string 1. Reverse the individual words 2. After reversing the words, …

Read more

Divide a string in N equal parts

Write a program to divide the given string into N equal parts. (N is input) Examples a) Input string : “stringlength”, N = 2 Output : string length b) Input string : “tutorialcup”, N = 3 Output : Invalid input! Because, string cannot be divided into N equal parts. Algorithm …

Read more

Translate »