Skip to content

Instantly share code, notes, and snippets.

@lingtran
Last active June 25, 2016 04:13
Show Gist options
  • Save lingtran/4e88a0141a7dcf3e7c48a6f6516bdb04 to your computer and use it in GitHub Desktop.
Save lingtran/4e88a0141a7dcf3e7c48a6f6516bdb04 to your computer and use it in GitHub Desktop.

##Leap My code: here

  • Responder #1 (here): Similar implementation but less verbose. I prefer to be explicit in the boolean values.

  • Responder #2 (here): Same implementation as the first responder. Seems like they are also less verbose! However, syntatically it would be easier to read if they had more parentheses to group their logic more clearly with their conditional statements.

  • Responder #3 (here): The ordering of conditions does not seem to reflect the logic behind calculating whether or not a year is a leap year. It does not seem logical to determine whether a year is a century year or a non-century year, and then add an absolute condition for whether or not the year is divisible by four.

  • Responder #4 (here): Similar implementation as mine in that it's explicit in returning boolean values, however would give same feedback as given to responder 3's implementation. It seems to be missing the case for a non-zero digit year.

  • Responder #5 (here): Similar implementation except for grouping of conditions, and their local var assignment for year. I don't think it's necessary to make a local var for year because it seems redundant and does not really make a difference.

##Hamming My code: here

  • Responder #1 (here): Implementation is not as explicit as expressing the ideas behind calculating Hamming Distance via more generic names of variables. I prefer to give names that convey intentions specifically when there are subject matter specific concepts such as Hamming Distance. Otherwise, same implementation but theirs is within one object. Interesting that they threw exception case first.

  • Responder #2 (here): Same implementation as responder #1, but found comment about throw method insightful.

  • Responder #3 (here): Neat implementation that leverages Arrays such that it has shown me new JavaScript Array methods. Appreciate naming of things as they are not cryptic.

  • Responder #4 (here): Same ideas behind how we name our functions and variables. However, implementation is not written in readable format. Also, does not seem necessary to split string as indices can be utilized for data type.

  • Responder #5 (here): Similar implementation as most of responders above.

##Rna Transcription My code: here

  • Responder #1 (here): Implementation is more verbose with multiple conditions. Prefer my implementation with a dictionary - come to think of it, maybe I should have defined a constant instead of a normal variable. Appreciate the naming of inputs to convey inner-relational workings of function. And introduced a new way of appending and concatenating strings for me.

  • Responder #2 (here): Different implementation with use of replace method and regex. Neat approach with such few lines! Educational.

  • Responder #3 (here): Another implementation using regex and replace methods. But seems it can be more efficient with the use of a dictionary/library for the DNA-RNA complements so as to reduce number of replace method chains. And therefore more readable.

  • Responder #4 (here): Same comment as for first responder.

  • Responder #5 (here): Same comment as for first responder.

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