Showing posts with label Leetcode 140: Word break II. Show all posts
Showing posts with label Leetcode 140: Word break II. Show all posts

Sunday, May 6, 2018

Leetcode 140: Word break II (Add subroutine to check if breakable)

May 6, 2018

Introduction


It is the time to learn the algorithm as quick as possible. I came cross this Chinese blog and I like to generate a gist first, and then write C# code based on the blog.

Algorithm practice


Here is C# code passing online judge of Leetcode 140: word break II.

Leetcode 140: Word Break II (brute force solution)

May 6, 2018

Introduction


It is hard level algorithm called Leetcode 140: Word Break II. I like to go over some ideas through most viewed discuss first. Now it is 9:30 PM, I like to spend 30 minutes to read a few answers.

Now it is 9:39 PM. I decided to go over the blog written in Chinese first, and then make a gist based on the analysis. I like to understand the analysis from the author.

Algorithm practice


Now it is 11:03 PM.  I finally put together C# code using the idea in the above gist. Based on the original author's advice, the solution will time out for a super long string test case. I still need to work on the correct solution to pass all test cases.





Monday, April 23, 2018

Leetcode 140: word break II

April 23, 2018

Introduction

Here is one post I like to study for Leetcode 140: word break II. I need a few hours to play with the algorithm so that I can understand better.

Wednesday, February 21, 2018

Leetcode 140: Word break II (VI)

Feb. 21, 2018

Introduction


I like to practice the idea shared by the students with a coding blog and also with a record solving more than 500 Leetcode algorithm. I like to learn from the player. Here is the link.

Here is the idea I learned from hard level algorithm regular expression matching on mock interview. After I practice over 10 times with high ranking peers, I quickly learned so many things and am confortable to write a dynamic programming solution.

I like to choose 10 people to learn from and then write code based on their sharing.


Leetcode 140: Word break II (VI)

Feb. 21, 2018

Introduction

One idea to learn a hard level algorithm is to give some support for the other people. I found the post with sharing tips how to avoid TLE error, so it is good to try the idea as well. Here is the link. I voted before I try the idea.


Leetcode 140: Word break II (V)

Feb. 21, 2018

Introduction


Plan to write my fifth practice based on the idea using DFS + DP + Trie. Here is the discussion link. The student completed more than 444/761 questions. I like to learn from the player.


Algorithm practice

Feb. 26, 2018 8:45 PM
Here is my C# code. The class TrieNode's design is interesting. It took me sometime to figure out and know that it will work.



Leetcode 140: Word break II (IV)

Feb. 21, 2018

Plan to write C# code based on this Java code DFS with pruning idea. Here is the link.

Leetcode 140: Word break II (III)

Feb. 21, 2018

Introduction


It is a good idea to study some code and then write the idea using C# programming language. I do know that one thing I can improve to learn a hard level algorithm is to read as many as possible ideas with solutions. And then I should practice some coding.

Specially the first hour of the day is best time for me to train myself to write good code.

Here is Java code using DP and Trie. I like to write one using C#.

Leetcode 140: Word break (II)

Feb. 21, 2018


Introduction


It is my idea to learn the hard level algorithm. Write at least 10 implementation and write as many ideas as possible.

Here is the idea for my second practice.