Tuesday, May 24, 2016

Leetcode 127: word ladder (Medium)

May 24, 2016

Work on the algorithm. Will come back very soon.

Review previous practice:
https://github.com/jianminchen/Leetcode_C-/blob/master/127wordLadder.cs

blog:
http://juliachencoding.blogspot.ca/2015/06/leetcode-word-ladder.html

1. Study Java code:
https://github.com/jianminchen/LeetCode-Java-Solutions/blob/master/127.word-ladder.java

and then, spend 30 minutes to write C# version.
https://gist.github.com/jianminchen/8d9aeaaa8ad98fd1bc4a78237118506c

change a string variable name anb to s, Queue q -> queue, qLen->queueLen, int length -> ladderLength
https://gist.github.com/jianminchen/8f1081b25010c572b0a674e43ffba1e5

use Tuple class to replace two queues with one queue only
https://gist.github.com/jianminchen/60211d6ef2ae9c6b3142570b45525e21

No comments:

Post a Comment