Posts

Showing posts from September 15, 2021

Sort Integers - Outside Square Brackets

Image
 Sort Integers - Outside Square Brackets PROBLEM STATEMENT : The program must accept a list of integers where some groups of integers are enclosed within a pair of square brackets. The program must sort(in-place) the integers that occur outside the square brackets in the given list. Then the program must print the revised list of integers as the output. Note: The given list does not have nested square brackets. Boundary Condition(s): 1 <= Number of integers in the given list <= 100 1 <= Each integer value <= 10^5 Input Format: The first line contains a list of integers separated by a space, where some groups of integers are enclosed within a pair of square brackets. Output Format: The first line contains the revised list of integers based on the given conditions. Example Input/Output 1: Input: ( ) 40 20 [50 10 60] 30 [9 8 7 5 1] 15 65 25 Output: 15 20 [50 10 60] 25 [9 8 7 5 1] 30 40 65 Explanation:  The integers that occur outside the square brackets ar...