#84Can you get the loop ?


You are given a node that is the beginning of a linked list. This list always contains a tail and a loop.


Your objective is to determine the length of the loop.


For example in the following picture the tail's size is 3 and the loop size is 11.


Image and video hosting by TinyPic


// Use the `getNext()` method to get the following node.


node.getNext()

Note: do NOT mutate the nodes!


Thanks to shadchnev, I broke all of the methods from the Hash class.


Don't miss dmitry's article in the discussion after you pass the Kata !!



 #83 Stop gninnipS My sdroW!


Write a function that takes in a string of one or more words, and returns the same string, but with all five or more letter words reversed (Just like the name of this Kata). Strings passed in will consist of only letters and spaces. Spaces will be included only when more than one word is present.



Examples:


spinWords( "Hey fellow warriors" ) => returns "Hey wollef sroirraw" 

spinWords( "This is a test") => returns "This is a test" 

spinWords( "This is another test" )=> returns "This is rehtona test"


 #82Evil Autocorrect Prank


Your friend won't stop texting his girlfriend. It's all he does. All day. Seriously. The texts are so mushy too! The whole situation just makes you feel ill. Being the wonderful friend that you are, you hatch an evil plot. While he's sleeping, you take his phone and change the autocorrect options so that every time he types "you" or "u" it gets changed to "your sister."


Write a function called autocorrect that takes a string and replaces all instances of "you" or "u" (not case sensitive) with "your sister" (always lower case).


Return the resulting string.


Here's the slightly tricky part: These are text messages, so there are different forms of "you" and "u".


For the purposes of this kata, here's what you need to support:


"youuuuu" with any number of u characters tacked onto the end

"u" at the beginning, middle, or end of a string, but NOT part of a word

"you" but NOT as part of another word like youtube or bayou


+ Recent posts