Grokking Data Structures & Algorithms for Coding Interviews
Ask Author
Back to course home

0% completed

Vote For New Content
Not required pop

venkatlearning11

Dec 11, 2023

Not required pop and stack for this problem, because if you do below condition that would remove start right?

for (char c : s.toCharArray()) { // Loop through each character in the input string if (c != '*') { // If the character is not '*' stack.push(c); // Push (add) the character to the stack } }

0

1

Comments
Comments
Leopoldo Hernandez
Leopoldo Hernandez2 years ago

You'd still need to get rid of the character that comes after.

On this page