We have already seen the problem to print first repeating character in a string. In this post we will be looking at printing all the repeating characters in the string. For example: Input String: “www.ritambhara.in” Output: w.ria Input String: “social.ritambhara.in” Output: ia.r Input String: “meenakshi” Output: e Note that we are printing the repeating character […]
Give a string in which characters may be repeating. Print the first character (from the start) which is repeating in the string. For example: String: ABCBCD Output: B (A is not repeating, hence B is the first character which is repeating) String: ABCDE Output: NULL (No character repeating)
We have already seen the problem to reverse the words in a string, in the solution to that problem we have also written function to reverse the string. That was a non-recursive (iterative) function. Write a recursive function to reverse the String. For example: If the String is “ABCD” then the output should be “DCBA“. Before […]
Given a String, reverse the string but do not reverse the words. For example, if Input : “MCN Professionals is now Ritambhara” Output: “Ritambhara now is Professionals MCN” Your function should not take more that O(n) time in the worst case.
Given two strings, write code to print all inter-leavings of these strings. For example: if the two strings are “AB” and “12”, then the output should be: AB12 A1B2 A12B 1AB2 1A2B 12AB Note that the order of characters in the individual strings are not changed in the output.