Saturday, May 28, 2016

Leetcode 126: word ladder II - warm up practice

May 28, 2016

  Share professional tennis player Kristina Mladenovic tweet:
https://twitter.com/kikimladenovic/status/732966170375114752

I know what it takes to win. Forget everyone else and put the work in.

Spend one hour to work on the word ladder II, Leetcode 126.
Previous blog:
http://juliachencoding.blogspot.ca/2016/05/leetcode-127-word-ladder-medium_24.html work on one test case:
hit-> cog
Dictionary<string, int> has entries:
Let us talk about a test case to help understand the work:
           hit -> cog
           Two transformation paths:
                         dot -> dog
           hit -> hot ->            -> cog
                         lot -> log
                         
           dist value is 5
           Dictionary<string, int>
           key    value      new value
           hit     0            4
           hot     1            3
           dot     2            2
           lot     2            2
           dog     3            1
           log     3            1
           cog     4            0

Extract a function called resetDistanceFromEnd

 https://gist.github.com/jianminchen/ca720a93cb8e8fd12610ba58fef9889f


No comments:

Post a Comment