Zigzag Conversion

In the Zigzag Conversion problem, we have given a string s of length n and an integer r representing the number of rows. Convert the given string in the zigzag pattern of r rows and concatenate the characters row-wise. Print the new concatenated string. Example Input :  s = “TutorialCup” …

Read more

Next Permutation

In the next permutation problem we have given a word, find the lexicographically greater_permutation of it. Example input : str = “tutorialcup” output : tutorialpcu input : str = “nmhdgfecba” output : nmheabcdfg input : str = “algorithms” output : algorithsm input : str = “spoonfeed” output : Next Permutation …

Read more

Repeated Substring Pattern

In repeated substring patterns we have given a string check if it can be constructed by taking a substring of itself and appending multiple copies of the substring together. Example Input 1: str = “abcabcabc” Output: True Explanation: “abcabcabc” can be formed by repeatedly appending “abc” to an empty string. …

Read more

Longest Common Prefix using Sorting

In the Longest Common Prefix using Sorting problem we have given a set of strings, find the longest common prefix. i.e. find the prefix part that is common to all the strings. Example Input1: {“tutorialcup”, “tutorial”, “tussle”, “tumble”} Output: “tu” Input2: {“baggage”, “banana”, “batsmen”} Output: “ba” Input3: {“abcd”} Output: “abcd” …

Read more

Regular Expression Matching

In the Regular Expression Matching problem we have given two strings one (let’s assume it x) consists of only lower case alphabets and second (let’s assume it y) consists of lower case alphabets with two special characters i.e, “.” and “*”. The task is to find whether the second string …

Read more

Translate »