(1) What were the steps you took to solve some of these challenges?
(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?
(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