Week 10 - CST 338 Learning Journal
When solving the CodingBat challenges, I mostly looked at the examples given and tried to figure out the pattern before writing code. For the String problems like countHi and countCode, I realized pretty quickly that I needed to loop through the string and grab substrings of a fixed length to check for matches. That approach worked well across multiple problems so I reused it.
For the most part I threw code at it first and adjusted when it didn't work. The Map problems were more straightforward since it was mostly just checking if a key existed and then putting or removing values. Those I was able to get on the first try by just reading the instructions carefully.
What didn't work at first was the Functional problems like doubling and square. The logic itself was right using stream and map, but the editor kept stripping the method signature which caused compile errors. It took a couple tries to figure out that I needed to paste the full method including the signature, not just the return statement.
Most problems took one or two tries. The string problems occasionally needed a small fix like adjusting the loop boundary to avoid going out of bounds. Overall the biggest challenge wasn't the logic but making sure the syntax was exactly right.
Comments
Post a Comment