DEV Community

salcasta
salcasta

Posted on

My Time in the Ruby Gym

I completed the ruby gym over the weekend and wanted to document my thoughts on the challenges. Some were easy, others were hard, but fun. So, let us begin...

Think fast

At first glance I thought it was going to be easy, but I did run into a lot of syntax errors. Once they were resolved the rest fell into place. Overall it was a fun challenge.

Twofer

This was the easiest of all the challenges. Once I went with .length to determine if the array gave a name or an empty string the rest was standard.

Dice Roll

Another straight forward challenge, but when trying to pass the test an error kept coming up. I had to switch the placement of my guess and roll variables. Once I did that, the last test passed.

Leap Year

This was the hardest of all the challenges. I took a simple approach, but once I accepted that a more complex approach was needed I finally started to make some progress. I needed to do some more research on how leap years are calculated. Google was a big help in solving this challenge.

Secret Encoder & Secret Decoder

These two challenges are pretty much the same. Looking back I could have made things a lot easier using .each to loop through the array created by using .split("") Through trial and error I was able to solve this challenge.

Sum Odd Integers

This was a fun challenge that required a game plan to solve. Similar to the encoder and decoder challenges I should have used .each to loop through the array to make things easier.

Raindrops

This challenge required a lot of thinking before actually writing any code. My biggest time waster was trying to solve this challenge using one if statement. Once I abandoned that idea and went with 3 separate if statements I was able to solve it quickly.

Character Types

For this challenge I needed to read more about regexp and how to use it. Scanning the string if 0-9 is present to differentiate between a word character and a number character.

Count "the"

Similar to the last challenge, my success depended on my knowledge of regexp. Once I was able to use the right notation to scan for all the "the"s without triggering "the" inside of words like "them" or "they" I was able to solve it. Regexp is a powerful tool so, I was happy to read up on it and expand my knowledge.

Final Thoughts

It felt good to solve coding challenges again. I look forward to solving more ruby challenges to expand my ruby knowledge in the future. If I make the final cut into the DPI program I hope to do one ruby challenge a day during the 3 month training. Become a lean mean problem solving machine!

Top comments (0)