2019 AP Computer Science A FRQ #3B

2019 AP Computer Science A FRQ #3B

Write the method isBalanced, which returns true when the delimiters are balanced and returns false otherwise. The delimiters are balanced when both of the following conditions are satisfied; otherwise, they are not balanced. 1. When traversing the ArrayList from the first element to the last element, there is no point at which there are more close delimiters than open delimiters at or before that point. 2. The total number of open delimiters is equal to the total number of close delimiters. Timestamps Intro: 00:00 Pseudocode: 00:25 Writing the code: 02:47 Testing with the first example: 05:52 Testing with the second example: 07:57 Testing with the third example: 08:55 Testing with the fourth example: 09:31 Final solution: 10:34