Загрузка...

Solve the problem in C ++ only

Thread in C/C++ created by YaSosuBibu_inactive3639457 Nov 4, 2020. 190 views

  1. YaSosuBibu_inactive3639457
    YaSosuBibu_inactive3639457 Topic starter Nov 4, 2020 Banned 0 Nov 3, 2020
    Given a sequence of N round, square and curly brackets. Find out whether you can add the numbers and arithmetic operations so you could obtain a correct arithmetic expression.

    Input
    The first line contains the number of brackets - N (1 ≤ N ≤ 100 000).
    The second contains the sequence of N symbols from the set (,) [,] {,}.
    Output
    Displays the word "Yes", if you can get a correct arithmetic expression, or "No", if you can not.

    Note: Use struct,pointer,dynamic memory;

    Sample 1

    Input;

    6
    ([())]

    Output;

    No

    Sample 2;


    Input;

    24
    {[()([]{})[]]({}{{}})}[]

    Output;

    Yes
     
Top
Loading...