A valid mathematical expression can also have duplicate parenthesis as shown below: ((a+b)) (((a+(b)))+(c+d)) Write code to find if an expression has duplicate parenthesis. You may assume that expression does not have any white spaces.
In C language, string library has a function strcmp that takes two arguments and return -1, 0 or 1 depending on whether first string is less than equal-to or greater than the second string. int strcmp(const char *str1, const char *str2); Write similar function that compare strings given in the form of linked list, For […]
Given two strings, write a function which will print characters coming on only one of the two strings (and not both). The character may be repeated in that string. For example: String-1 String-2 Output ——— ———- ————- AFW BGF AWBG AFAAW BGFFB AWBG BGF AWBG AFW BGH AFWBGH AFW BGF AWBG
Write a function which will print the character coming maximum number of times in a given String. For example: Input String: ritambhara Output: a Because character ‘a‘ appears 3 times in the String.
Given a String in which characters may be repeating. Find the length of longest substring of where all characters are unique (non-repeating). For Example: If the String is “RITAMBHARA” Length of Longest substring with unique characters = 7 (“RITAMBH”)
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 […]