Approach
-
Initialize the stack, either in Stack or ArrayDeque
-
Define the result structure, maybe in Array or Map or StringBuilder
-
Loop through the element based on template
-
Return the result
Initialize the stack, either in Stack or ArrayDeque
Define the result structure, maybe in Array or Map or StringBuilder
Loop through the element based on template
Return the result