Pages

Sunday 11 January 2015

LeetCode Solutions

  1. Word Ladder :  
    1. http://www.programcreek.com/2012/12/leetcode-word-ladder/ -
      If you are queueing and removing the element from the dict as done here, then you can calculate the minimum length. But you cannot calculate all possible lengths. As you remove it from the dict, that state is into the queue. All that matters is whether the end is reachable from that state or not. We dont care if we can reach that state from any other state or not. 
    2. http://yucoding.blogspot.com/2013/08/leetcode-question-127-word-ladder.html  - Double breadth first search. This is a very good post to learn bi directional search.


  2. Scramble string leetcode : http://www.lifeincode.net/programming/leetcode-scramble-string-java/ Understand the DP part
  3. Permutations : http://www.lifeincode.net/programming/leetcode-permutations-and-permutations-ii-java/
  4. K Sum - http://lifexplorer.me/leetcode-3sum-4sum-and-k-sum/ -  
  5. Solve the KSum problem better one and also solve the 4sum yourself.
  6. Combinations(n,k) - http://lifexplorer.me/leetcode-combinations/
  7. Spiral Matrix : http://www.geeksforgeeks.org/print-a-given-matrix-in-spiral-form/

No comments:

Post a Comment