Proof of Completion and Running on Open Coding Society Code Runner Part A

Proof of Completion and Running on Open Coding Society Code Runner Part B

Key Takeaways
-
String Manipulation with substring(): Building a new string by combining parts of the original using
substring(),charAt(), and string concatenation is a core technique for rearranging characters. -
While Loop vs For Loop for List Removal: When removing elements from a list while iterating, a
whileloop with manual index control avoids skipping elements. Only increment the index when you don’t remove. -
Comparing Strings with .equals(): Always use
.equals()to compare string content in Java, never==. This was critical inscrambleOrRemoveto check if the word changed. -
Pattern Matching in Strings: Scanning for a specific pattern (like ‘A’ followed by a non-‘A’) requires checking consecutive characters with
charAt(i)andcharAt(i + 1), while being careful not to go out of bounds. -
Modifying a List In-Place: Using
wordList.set(i, value)to replace andwordList.remove(i)to delete lets you modify the original list directly without creating a new one.
Area of Stuggle
One thing I noticed while working through this FRQ is that string manipulation in Java can get tricky fast. Building a new string with substring() and charAt() makes sense conceptually, but getting the indices right took some trial and error. I kept making small mistakes like being off by one on the substring boundaries, which would either cut off a character or duplicate one The other part that tripped me up was modifying a list while looping through it. My first instinct was to use a regular for loop going forward, but that caused elements to get skipped after a removal. Switching to a while loop where I only increment the index when I don’t remove fixed that, but it took a few debug cycles to realize why elements were being skipped in the first place. This is definitely a pattern I need to work on for the AP Exam.