Skip to content

Instantly share code, notes, and snippets.

@j-sm-n
Last active November 28, 2016 03:12
Show Gist options
  • Save j-sm-n/0bab542beface25267e19a520c7e7b49 to your computer and use it in GitHub Desktop.
Save j-sm-n/0bab542beface25267e19a520c7e7b49 to your computer and use it in GitHub Desktop.

Hamming

My code here

  • Responder #1 (here) - This responder took largely the same approach as me but used the charAt() JS function rather than splitting up the strings into arrays like I did. In this case, I feel like I should have used this built-in JS method rather than taking an extra step and creating two arrays and checking each character at their respective indices.

  • Responder #2 (here) - This responder used the forEach() method rather than using a for loop like I did. I'd like to know which is a more efficient method; otherwise, we handled the problem the same way.

  • Responder #3 (here) - The approaches this responder and I used vary a bit more this time--he broke out a lot of his methods into functions, which seems a bit more organized than mine, but it takes up more lines of code that seem unnecessary. He also made his own error function, which is a cool work arround the Error function JS has.

  • Responder #4 (here) - This responder's approach is also almost exactly identical to mine--I'm just not sure what the difference is between using throw new Error() or throw Error() is. The new didn't seem necessary to pass my test, but is there another reason it needs to be there?

  • Responder #5 (here) - Again, this responder's result is similar to responder #1's, but this time they saved the string lengths into variables to check that they were the same length.

Food Chain

My code here

  • Responder #1 (here) - This responder pretty much mirrored how I handled this exercism with the execption of how we started off with the lyrics to the song.

  • Responder #2 (here) - I really like the switch(); function this responder used in order to handle the verse(); fucntion. I'll definitely try to utilize this in the future.

  • Responder #3 (here) - This responder really broke out the different portions of the song--it seems super organized. I like how they also used for loops for iterating through the song.

  • Responder #4 (here) - I think it's interesting how you can kind of tell that this responder only worried about making the spec pass for the first few tests and then handled retrieving the middle lyrics later in the program.

  • Responder #5 (here) - I think it's really interesting how this responder organized the verses by the type of "food" the old lady would eat. I definitely feel like I should have broken up the lyrics into a JS object for this exercise.

Binary Search Tree

My code here

  • Responder #1 (here) - This responder used an approach that is similar to mine. I'm thinking now that I didn't need to use this.left or this.right when creating my Bst JS object.

  • Responder #2 (here) - I'm not really sure how lines 23-31 are working, but before that, this responder's program totally follows the same suit as mine.

  • Responder #3 (here) - I'm a pretty big fan of how this responder chose to handle their each(); method. And I like how they broke out an insertOrMake(); method to use within their insert(); method.

  • Responder #4 (here) - I'm interested to know why this responder chose to turn the JS object they were building into an array, but otherwise it seems well broken out compared to mine.

  • Responder #5 (here) - This one pretty much mirrors my approach to this program.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment