InfyTQ


  1. Given a string, find the substring based on following conditions:

    • The substring must be the longest one of all the possible substring in the given string.
    • There must not be any repeating characters in the substring.
    • If there is more than one substring satisfying the above two conditions, then print the substring which occurs first.
    • Length of the substring must be minimum 3.

    If there is no substring satisfying all the aforementioned conditions then print -1.

    Sample Input1:
    hello
    Sample Output1:
    hel
    Sample Input2:
    heello
    Sample Output2:
    -1

    Click Here for Solution



  2. Given an expression string expression, write a program to examine whether the pairs and the orders of {, }, (, ), [, ] are correct in expression.

    Sample Input1:
    [()]{}{[()()]()}
    Sample Output1:
    Balanced
    Sample Input2:
    [(])
    Sample Output1:
    Not Balanced

    Click Here for Solution



  3. Write a C program to print the first half of the list at last and last half of the list at first.
    Input format:
    First-line contains the size of the array.
    The second line contains elements of array separated by space.
    Output Format:
    Modified Array
    Sample Input1:
    5
    1 2 3 4 5
    Sample Output1:
    4 5 3 1 2
    Sample Input2:
    6
    1 4 6 2 3 5
    Sample Output2:
    2 3 5 1 4 6

    Click Here for Solution



  4. Write a program to remove the given word from the input string. If the substring is not present in the input string, then print the input string.
    Input Format:
    First-line consists of the sentence.
    Second line consists of the words which we want to remove from the given sentence.
    Output Format:
    Sentence after the given word is removed.
    Sample Input1:
    Python is object oriented scripting language.
    object oriented
    Sample Output1:
    Python is scripting language.
    Sample Input2:
    Python is object oriented scripting language.
    programming
    Sample Output2:
    Python is object oriented scripting language.

    Click Here for Solution