Monday, June 24, 2024

CST 338 - Week 1

Discuss the process of solving the Coding Bat challenges.

(1) What were the steps you took to solve some of these challenges?

My initial steps to solving the problems involved reading the problem a couple of times and thinking through how I would approach the first step, such as iterating through a string using a for loop. I found myself struggling with some of the problems, spending over an hour on a couple of them. I should have come back to it later instead of overthinking my solution. When I struggled, I tried to reference the Java help sections on the Codingbat website and rewatched the videos.


(2) Did you plan it out or throw code at it?

Generally, when working on the problems, I plan my approach and write comments on what I need to accomplish for each line or comment on my thought process to stay on track and explain why that solution works. There were a few times when I was tired and frustrated, and I just kept trying different ideas until the code ran. Occasionally, if my shorter solution wouldn't work, I would essentially "brute force" my solution with more lines of code than likely needed.


(3) What worked?

I found that using the basic concepts explained in the respective sections on the Codingbat website was all I needed to solve the problems. I often went to using "for loops" and "if statements" for many of the problems.


(4) What DID NOT work?

I tried using the ternary operator multiple times for a few problems, but I could not get it to pass all the tests. I would pass every test except for one or two, so I decided to default to if statements. These were some of the problems I spent way too long trying to complete.


(5) How many tries did it take?

For the easiest problems, I usually needed 1-4 tries, often because I forgot semicolons or misspelled something. For the tougher problems, it took anywhere from 10 to 20 tries, and I spent at least an hour on a couple of them. Later, I discovered various methods on the Oracle website that would have made some of the problems shorter, such as the .endsWith and .startsWith methods.

No comments:

Post a Comment

CST462S - Service Learning Experience

With the first half of my Summer semester now coming to a close, I am submitting my final assignments and preparing for the upcoming class i...