Most Letters

Write a method that takes a string in and returns true if the letter”z” appears within three letters **after** an “a”. You may assume that the string contains only lowercase letters.

My solution: 

screen-shot-2016-09-09-at-3-25-22-pm

Note placement of “return false” and “return true”.  I keep making the same mistake of placing them in the wrong spot or not explicitly including them in the code.

Provided Solution: 

screen-shot-2016-09-09-at-3-26-30-pm

Advertisements
Most Letters

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s