Saturday, April 9, 2016

HackerRank - count string (V) - C plus plus solution

April 9, 2016

Spend one hour (4:00pm - 5pm) on this C++ solution, talk about the code and implementation:

C++ solution


Julia needs to figure out the design:

For test case:
1
((ab)|(ab)) 2

The design is to construct a graph, NFA, and then, convert it to DFA, and the count how many ways.

It is hard to teach yourself through HackerRank a solution; so, Julia likes to catch up by some reading. Searching the web ...

Read some blogs to get some help:

1. Not very useful


2. Try to read it in 10 minutes

ucsd.edu lecture notes - homework solution

3. Another reading:  

30 minutes reading - excellent content! 

Julia learns better after she invested 8 hours to try to understand a problem, by playing with hackerRank. 

princeton.edu lecture notes - regular expressions


Julia, try to memorize content on the above slides.

Learn quickly from lecture notes, a diagram for NFA:
((ab)|(ba)) 2




No comments:

Post a Comment