Length of Longest valid Substring

Problem Statement In the “Length of Longest valid Substring” we have given a string that contains the opening and closing parenthesis only. Write a program that will find the longest valid parenthesis substring. Input Format The first and only one line containing a string s. Output Format The first and …

Read more

Palindrome string (number)

Check whether the given string is palindrome or not. Given string is form of positive number. Palindrome: If we reverse the string if it looks the same then it is called as palindrome. Examples Time complexity : O(n) Algorithm a. Copy the number and store it in temp. b. Create …

Read more

Shortest Superstring Problem

Given array of strings, write a function that will print the smallest string that contains each string in the array as substring Example INPUT arr[] = {“catlog”, “dog”, “loggk”, “xcatdo” } OUTPUT “catloggkxcatdog” In the output string, all the strings in the given array are substrings Algorithm 1. Create a …

Read more

Translate »