Monday, April 11, 2016

HackerRank: String Calculate function (III) - Suffix array (II)

Plan to work on LCP array later. 

Use C# implementation of suffix array in blog #1, still time out on hackerRank

SuffixArray implemented in C#, by MSFT, Google employee; Julia has to catch up C#, and learn 
how to write beautiful code like this:

Study C# code how to implement IEnumberable interface in suffixArray code:

how String.Compare api is designed
Julia also takes some time to work on suffix array, and get some drawing about suffix tree, and play with two case:
aaaaaa, 
banana, 
abcabcddd, 
For those two strings, what are suffix tree? Get so close to concrete examples, draw diagram, run test case, study code, and compare to other C# submission. 

Focus on how to find the range of suffix array to fit in the pattern: 


Walk through the examples how suffix array is implemented in C# code:


public SuffixArray Search(string str)

        {
            if (m_lower > m_upper)
                return this;
            // Otherwise search for boundaries that enclose all
            // suffixes that start with supplied string.
            var lower = Search(str, c_lower);
            var upper = Search(str, c_upper);
            return new SuffixArray(m_text, m_pos, lower + 1, upper);
        }

Example 1: string "aaaaaa", pattern string "aaa". 
suffix array {5, 4, 3, 2, 1, 0}
suffix string:
a
aa
aaa
aaaa
aaaaa
aaaaaa

suffix array is acending order, string.Compare("a","aa")  = -1, string.Compare("aa","aa") = 0. string.Compare("aa","a") = 1

suffix array is implemented using interface IEnumberable. 
we try to find 2 index, low, top, 
index = 1, "aa", string.compare("aa", 0,"aaa",0, 3) = -1, 
now, we need to find top index, 
assume that "abc" is in the array, string.compare("abc",0,"aaa",0, 3) = 1, first one is >-1, stop; 
aaa, aaaa, aaaaa, aaaaa, all computed value of comparison = 0 since we only check substring with length 3. 
So top index is 5. 
So, count of substring "aaa" is calculate by top index - low index + 1
top index = 5, 
low index = 1+1
so count = 4. 

Try to figure out how this binary search algorithm is used to calculate low index and top index, called twice, comparison value for low index = 0, for high index is -1. 
In other words, find last one is smaller than "aaa", and first one bigger than "aaa". 

Example 2: "banana", pattern "ban", 
 Read the content in the blog first:
http://www.geeksforgeeks.org/pattern-searching-set-8-suffix-tree-introduction/

And then, 
suffix strings:
banana
anana
nana
ana
na
a

Sort them ascending order:
a
ana
anana
banna
na
nana

pattern string "ban", first to find a string which is last one < "ban", -> "anana", index 2, "ana" < "ban"
and then, find first string which is bigger than "ban", only comparing length 3 substring, 
"banna" = "ban" based on comparison (substring len = 3), so
"na" - index = 4 > "ban"
2+1 = 3, 
top index = 3 
so, ban pattern match is  3-3 +1 = 1



"Work on Examples First" - Practice feels good!

The LCP-LR array helps improve this to O(m+logN)O(m+logN), in the following way


LCP array reading
https://www.hackerrank.com/challenges/pseudo-isomorphic-substrings/topics/lcp-array

https://en.wikipedia.org/wiki/LCP_array

Follow up: May 4, 2015
Read the article:

June 10, 2016 - Plan to spend 30 minutes to read the slides:

Julia, learn something here from the blog:

http://decomplexify.blogspot.ca/2014/07/lcp-array.html?view=classic

Sunday, April 10, 2016

HackerRank: String Calculate function (III) - Suffix array

April 10, 2016

Time spent: 9:00pm - 11:40pm

Problem statement - string calculate function on Hackerrank 



KMP Algorithm, Rabin Karp Algorithm, Finite Automate based Algorithm, Boyer Moore algorthm. 

All of the above algorithms preprocess the pattern to make the pattern searching faster. The best time complexity that we could get by preprocessing pattern is O( n ) where n is length of the text. 

So, Julia second try still failed, no progress on time out issue. 

Now, Julia read the blog and learn suffix array / LCP array in next hour 9:00 pm -10:00 pm:

A suffix tree is built of the text. After preprocessing text (building suffix tree of text), we can search any pattern in O(m) time where m is length of the pattern. O(n) -> O(m), solve timeout issue. 

HackerRank: string function calculation (II) - string algorithm - Boyer Moore Algorithm

April 10, 2016


  Problem statement:

https://www.hackerrank.com/challenges/string-function-calculation

  Time spent: 3:40pm - 4:40 pm

First hour work, score 8.9 out of 80 points. 
The solution: 
https://gist.github.com/jianminchen/09c77ba32b156f765b4debb2bccba0c8


Brute force solution:

pass one test case: aaaaaa, return 12,

use Boyer Moore Algorithm, still time out:

time spent: 8:00pm - 8:45pm 



copy Boyer Moore algorithm code from the webpage:

convert the class from Java to C#. 

Julia second try:  (time out issue - Boyer Moore Algorithm does not help!!!)




HackerRank: string function calculation - string algorithm - Brute Force Solution

April 10, 2016

  Problem statement:

https://www.hackerrank.com/challenges/string-function-calculation

  Time spent: 2:40pm - 3:35pm 20 minutes to think, 20 minutes to write down in C#

Understand the problem, so, here are her thoughts:

Brute force solution:

pass one test case: aaaaaa, return 12,

failed test case:
abcabcddd,
wrong answer - Easy fix, index error on the loop

score 8.89/ 80

one test case: wrong answer
All other test cases time out

https://gist.github.com/jianminchen/09c77ba32b156f765b4debb2bccba0c8

Need to work on KMP, or Boyer-Moore algorithm, see how to make HackerRank happy, score more points.

http://www.cs.tufts.edu/comp/150GEN/classpages/BoyerMoore.html

blog:
http://juliachencoding.blogspot.ca/search/label/string%20functions%20review








Saturday, April 9, 2016

Mental skills to help players

April 9, 2016

  Competitive programming is like tennis sports. So, when Julia blogs her practice on problem solving on HackerRank, she also likes to journal her practice, for example, log time spent on.

 Here are the notes taken:

Mental Skills to Help Your Players

https://www.youtube.com/watch?v=E8-7LA9-UOY

Journaling practices/ Matches (27:24/39:58)
  • Date, Time, Type of Play (Practice/ Match)
  • Opponent ( if applicable)
  • Length of Time
  • Feeling
  • Emotions
  • Focus/ Concentration
  • Nutrition/ Hydration
  • 3 things you did well, 1-3 things to improve

Goal Setting:

  • smart goals
  • LT and ST goals
  • Set for practice and competition
  • Write them down!!!
  • Reflect on motivation and you commitment to these goals
  • Evaluate, assess, adjust goals as needed
Reference:

USTA Mental Skills and Drills Handbook

Action item: Read the book 20 pages. Take some short notes as well.





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




HackerRank: count string (IV) - JavaScript

April 9, 2016

 Spend some time later to go over this JavaScript solution, score 80 out of 80.

https://gist.github.com/jianminchen/4d5d2f77d0e23e424a0953aaf4e4276e


HackerRank: Count string (III)

April 9, 2016

 Problem statement

 Solution to study:

Julia's C# practice with bugs


 The code has time out issue, wrong answer, and it only scores 3 out of 80.

code source:

https://www.hackerrank.com/casaro

Statistics:

Time spent:  1:00pm - 3:00pm
Go through test cases

C# code to study, also show C# source code here.



April 10, 2016

Action items:

Need to think about in computer theory, NFA, DFA, and argue that the above solution in theory has flaws.

Follow up after 12 months


Julia checked the blog statistics, and the blog has a lot of views recently. So, she reformatted the blog style and she will review the algorithm very soon, and also post a question on code review.

HackerRank: Count strings (II)

April 9, 2016

Julia likes to have some adventure and just get into other people's solution, and quickly learn something in next 20 - 30 minutes.

Problem statement:


Statistics: time spent:  11:22am - 1:00pm

Here is the solution from a programmer working in Apple:

Code to study by Apple engineer


Comments after reading:

1. This problem is about DFA, NDFA, those content learning in Formal Language, how to build a compiler.

Friendly remind - great time to study formal language, first time for computer science master degree, score C in the course, and then in 2001 to prepare Ph.D. qualification example, Julia spent a lot of time to read the textbook again.
 

2. The string parsing is more complicate, '(', ')' should be treated as operator, and then, you can build up something.

3. Read the wiki webpage to quickly refresh knowledge
https://en.wikipedia.org/wiki/Deterministic_finite_automaton

4. Play with Visual studio and also the code - debug and run through the test case 20-30 minutes:
(ab)|(ba)  2
((a|b)*)  5

5. And put some diagram on the paper, take picture, post here and see if you can draw the state diagram for this machine.  ( 20 - 30 minutes)

Julia likes to read the code, and also debug the code;

Some facts:

1. she learned Formal language in 2001 to prepare Ph.D. qualification exam, but she never did spend time to work on an concrete example, debug the code to see how it is designed.

2. the code is well designed, and also beautiful code to read;

It is hard to figure out how to construct the Ndfa, but reading the code, Julia, you should figure out the design:




HackerRank - String algorithm - Count Strings (I)

April 9, 2016

Problem statement


Category: Difficult problem

Spend 25 minutes to think about problem, and then will get into other people's submission, and see what should be learned.

10:30 am - 10:55 am

Spent 25 minutes to think about the problem.

Try to express the expression using binary tree, like 1 + 2 * 3 problem using a tree.

So, ab can be express as a tree:

operator .
/       \
a       b


 a|b
operator |
/           \
a            b

a*
put * as parent node, and a is left child of operator node *

(a*)5
put 5 as the parent node of operator *

Structure the input as tree structure, and then, define different class - concatOp, orOp, starOp

Read the expression from left to right, and then, put it into data structure like a stack, and then, parse it, store it in the binary tree.

April 10, 2016 2:32 pm 

This is a graph problem, and also, the NFA, DFA problem. Julia, you are lucky to review the problem. Spend some time in the short future to go over code, give yourself a graph coding experience.

Elizabeth Holmes's Top 10 rules for success

April 9, 2016

 Watch the video:
https://www.youtube.com/watch?v=iwKs-eoPM-Y

 Take some notes:

1. Find your way
Love things you are doing; you will get back up after you are knocked down.

Talk about concept about 10,000 rule, you go so deep about something; you cannot be expert on it; when  you love it so much, then you do not let it go. That is winning about.

In other words, fail over and over again until you succeed.

2. Focus on your mission

3. Build people

4. #Believe

5. Don't have a backup plan

6. Embrace failure
Open to failure, fail over a thousand times to get it work at 1001th time. Determination to make it work.

7. Surround yourself with smart people

8. Don't do it for the money

9. Weather the storm
Big waves come and go, you are there for the reason.

10. Make a difference

June 1, 2016
Billionaire to nothing.

http://time.com/money/4353658/elizabeth-holmes-theranos-broke/?xid=frommoney_soc_socialflow_facebook_money


Friday, April 8, 2016

Article reading: Get that coveted tech interview

April 8, 2016

http://utsavized.com/getting-that-coveted-tech-interview/

Revamp your resume
organize, and make it simple and clear.
list your accomplishments in brief and succinct sentences. Include facts and numbers whereever applicable.

Make sure you have the right things on your resume

List out your personal projects

If you are prepared to devote a significant amount of hours each day, sacrifice your weekends and hangouts, to almost redo your entire Bachelor’s degree all by yourself, then that attitude and perseverance will undeniably get you through. And at the end, even if you don’t land the job, trust me, you will become a much more competent engineer than you are right now.

Julia's thought: It is true, practice makes difference. 

More reading:
https://www.quora.com/profile/Mohsin-Ali-19

https://drive.google.com/file/d/0B9lkfT8_oB3fdTRXUS1xZzBZT2s/view

Article reading: How to get hired at Microsoft

April 8, 2016

 Doing some research on high-tech companies interview process.

http://landthatinterview.com/microsoft/how-to-get-hired-at-microsoft/

one of the top 100 places to work across all industries.

Understanding how to navigate the screening and hiring process is also important.
1. Apply for jobs that you are qualified for
2. Don't be intimidated by job listings
hired for long-term potential

3. The inside angle 
Microsoft gives a lot of weight to references from current employees. 
not single monoculture, more like a conglomeration of many smaller companies. 

4. Apply for multiple jobs, but keep it targeted. 

Julia's thoughts: 
1. Need to study C++
2. Need to take some crash courses for distributed system, and other areas. 
3. Every month spend 5-10 hours to cover some topics - study and get educated.  

5. Be persistent
6. Make a good first impression 
It's not just about you - team effort, not lone cowboy coder. 
It is about you - be specific about contributions you have personally made toward the success of previous projects. 
7. Understand the interview process

Nov. 24, 2016
1. https://blogs.msdn.microsoft.com/ericlippert/2004/04/15/writing-code-on-whiteboards-is-hard/

2. http://sellsbrothers.com/tagged/interview

Article reading: Microsoft Interview Process

April 8, 2016

Doing some research. It is fun to write down what you read, and then, come back later to review again and again.

Take some notes from the following articles:

Land that interview
http://landthatinterview.com/microsoft/the-microsoft-interview-process/

Facts:
1. Microsoft is really structured like many small companies internally, each with their own recruiting teams.
2. a screening phone interview, also show that you are better than 90% of the hundreds of others

Advice for phone screen:
1. Talk talk talk in the technical phone interview, keep it on topic and don't try to steer the conversation, verbalize what you are thinking.
2. Second, have fun!
3. Ask a lot of questions and don't make assumptions. If you make assumptions, explicitly state that you are doing so and get the interview to buy in to those assumptions.
4. The hiring manager likes to know that the person will be engaged and productive.

Advice for interview in person:
1. 1 in 10 for a particular position -
2. proactively engage the recruiter
3. business casual attire, not a 3-piece (awkward)
4. first 3 interviews. May be interviewed by a developer, a test manager, a program manager, and the hiring manager. Finish before lunch time.
5. the as-appropriate interview - last regular interview will be over at round 4:00 in the afternoon.

Julia's comment:

 Julia likes to do some research on Microsoft interview process. Now, she knows that Microsoft does not practice interview as Google does, using hiring committee. 




Thursday, April 7, 2016

JavaScript - slide show case studies

April 7, 2016

Work on JavaScript, Css, html on picture slideshow.

Here is the list of sample code Julia chose to study.
1.
http://robertnyman.com/picture-slides/

Mental skills tip:
Julia read google employer's code about slideshow, how the code is structured and commented, and then, she found her issue.

Learning JavaScript, first thing, is not afraid to break things, learn the grammar first; Fix the style. She spent 3 hours to fix the style problem of her slideshow JavaScript legacy code. Make sure that the style is readable.
For example:
return a=1, b=1, c=1, d=1;
readable style:
return
a=1,
b=1,
c=1,
d=1;


2. page slide show 





3. Demo - 

source code:


Tips learned on April 8, 2016:

about comma in the JavaScript code: return statement:


understand return statement with multiple , commas

4. read more about JavaScript


http://www.itsalif.info/content/good-javascript-practices



Action item: 


Share the slideshow JavaScript as well. Make it more readable, using meaningful variables. 








Distributed System - study time

April 7, 2016

 Plan to study "Distributed System", get updated on this area.

 http://goo.gl/5BX1ND

 Take some notes.

 And read an article:

 https://www.cs.cmu.edu/~dga/15-440/F12/p3.pdf

Action item: next week
1. Spend 2+ hours to go over the lecture notes
2. Get rough ideas what are the big concerns in distributed system. (2+ hours)

Tuesday, April 5, 2016

HackerRank articles - reading time

April 5, 2016

 Julia's favorite articles on HackerRank:

 Recently, Julia starts to read articles on HackerRank, and she likes to take some notes:

 1. 8 ways to reduce bugs while coding
   http://blog.hackerrank.com/8-ways-to-reduce-bugs-while-coding/
  Tools: Findbugs - Java code, GetExceptional - Ruby apps, Selenium - web browsers

   unit tests & integration test/ use Tools / Compiler warnings / Code Review / Logs / Use existing libraries / Pseudo code / Avoid distractions

   Julia's thoughts:
 1. Write a small function
 2. Check variable scope - limit scope to minimum
 3. Design concern - make it easy, so every one can tell there is no problem.
 4. Push the coding problems to compile time not running time
 5. Document the test case above function, precondition/ post condition
 6. Have a lot of ideas to solve one problem, then, choose any one, you can write code right away
 7. Think about maintenance, use data structure, such as Array, go through loops - use iteration

    Recently, in March 2016, Julia uses a loop in JavaScript to add onclick() event - callback function; and then, finds out the variable i - iterated value is always the last one, not like C#,  and then, she figured out using closure concept; she started to write her first closure variable for real work. She got so excited. You can avoid using closure to finish a project, but when the code is reviewed the expert will know your strength - you never develop the muscle! Your code is like a fat, not a muscle.

   Push yourself to make the code most efficient mode first, and then, stay out of your comfortable zone; learn to be a good critic.

 2. Great article about learning
 http://blog.hackerrank.com/establish-yourself-expert/
 10% reading -> 20% Audiovisual -> 30% Demonstration -> 50% discussion -> 75% Practice doing-> 90% Teach others

 maximum learning happens when to "Teach others"

 Julia's thoughts:
  In 2015, Julia spent days/ weeks/ months on JavaScript learning, books reading, code snippets practice, video watching; But, in 2016, when she reads so many JavaScript submissions on HackerRank, she suddenly noticed that people are so good at JavaScript language, use it to solve daily simple algorithm problem, maybe as a hobby. She knows that it is also urgent to catch up JavaScript.

 3.
http://blog.hackerrank.com/programming-interviews-techniques-tips-by-gayle-laakmann/
  1. Simplify the question
  2. Create  assumptions
  3. Solve for simplified case
  4. Finally, generalize your answer

  Smart, write good code, who care about writing clean code

 4. Promoting Coding Culture in you campus
http://blog.hackerrank.com/promote-coding-culture-campus/
  self learning - MOCCs like Udacity, Coursera, edX
  Inculcate the habit of reading

 5. A stronger Programming Culture for India
 http://blog.hackerrank.com/stronger-programming-culture-india/

 HackerRank clubs
 Self learning attitude
 Rote-based education system has been detrimental
 Facts: IT graduates, only 25% are employable (as per Nasscom)

6. http://blog.hackerrank.com/how-to-crack-microsoft-interview/
 Arrive at the answer  (not just about arriving an answer)
 How you approach the problem (a lot about how you approach the problem)
 Your clarity of thought
 How you backtrack when you are stuck
 How you use the hints given to you.

Julia's thoughts:
Do some self-evaluation:
  1. Code skills - do you write a lot, read a lot of code recently? Warm up definitely helps.
  2. Do you like to solve the problem or not?
  3. Do you have some rituals to help you solve the problem?
For example, if you are so nervous, cannot think/ write as normal, what do you do?
Julia's answer: Find a simple test case, work out the design/ coding first.

  4.  Can you tell the problem difficulty level? Easy, medium, advanced  or difficult?
  5.  What kind of person you are in programming style? Are you a hacker?
  6.  How often do you practice problem solving?
  7.  What kind of tools you are using? Do you use HackerRank?
  8.  How many  peers you have - mock interview?
  9.  How often can you get some code screening? code assessment?
 10. Do you stay on the current moment or think about consequences? mental skills.

7. Productivity tips for programmers
http://blog.hackerrank.com/productivity-tips-for-programmers/

 1. write Unit test for higher productivity.
 2. Practice your programming.
 3. Use libraries and help improve them.
 4. Read code and technical stuff.

Julia's thoughts:
1. Julia did not find things exciting to do after work from 2010 - 2014, she found out that she does not develop strong interest, long term effort on somethings except tennis sports. So, she started to make change; Now, she likes to solve coding problems, and also she reduces a lot of stress as a developer. She knows a few more way to make the apps run good, easy to maintain.


Algorithm, Rotate matrix nxm clockwise 90 degree

April 5, 2016

  Write an algorithm to rotate matrix nxm clockwise 90 degree.

  Use no compiler, no Ctrl+C, and then, time complexity analysis:

Here is the code Julia wrote, she thought about the swapping strategies:
1. swap multiple times
2. leave four corners as is, swap four corners seperately.

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

/*
April 5, 2016

NO ctrl+C copy

matrix nxm rotate clockwise 90 degree

do it in place
*/

 public static bool rotateInplace90ClockWise(int[][] arr)
        {
            if (arr == null || arr.Length == 0 || arr[0].Length == 0) return false;
            int n = arr.Length;      // row
            int m = arr[0].Length;   // column

            if (n != m) return false;

            // we need to start loops

            int start = 0;
            int end = n - 1;

            while (start < end && start < n / 2 && end < n / 2)
            {

                // top with right swap - left the terminal point untouched
                // left to right <- row
                // top to down   <- column
                for (int i = start + 1; i < end - 1; i++)
                {
                    int currx = start;
                    int curry = i;

                    int currx_col = i;
                    int curry_col = end;

                    swap(arr, currx, curry, currx_col, curry_col);
                }

                // now, top down, we need to cross swap

                for (int i = start + 1; i < end - 1; i++)
                {
                    int currx = start;
                    int curry = i;

                    int currx_down = end;
                    int curry_down = end - i;

                    swap(arr, currx, curry, currx_down, curry_down);
                }

                // left and top swap
                for (int i = start + 1; i < end - 1; i++)
                {
                    // left part
                    int currx = end - 1 - i;
                    int curry = start;

                    int currx_top = start;
                    int curry_top = i;

                    swap(arr, currx, curry, currx_top, curry_top);
                }

                // and then, rotate four corners
                // 1, 2
                // 4  3
                swap(arr, start, start, start, end);
                swap(arr, end, end, start, start);
                swap(arr, start, start, end, start);

                start++;
                end--;
            }
            return true;
        }
 
       private static void swap(int[][] arr, int x, int y, int x2, int y2)
       {
           int tmp     = arr[x][y];
           arr[x][y]   = arr[x2][y2];
           arr[x2][y2] = tmp;
       }

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

time complexity: since every node in the matrix at most swaps twice, so the count of swap is O(n^2)

Sunday, April 3, 2016

HackerRank: string algorithm - Reverse Shuffle Merge (IV)

April 3, 2016


C# solution:

https://gist.github.com/jianminchen/346970ad058d64041ab7b8cbe9ecb495

Read the code, and talk about the ideas:
Best way to explain the algorithm - greedy one, the following, is to take away reverse, and also merge two parts (these are noisy!), work on a string, simple test case, how to construct a string with minimum lexically value, using stack to do greedy design, and also allow the back and forth two ways to optimize.

Here is the simple example:
1. string a2b2c2, for example, aabbcc, so abc is shortest one.
For string bbccaa,
first b, put in stack, second b, have to skip; and then, c is coming,
'c' > 'b', push c to stack, so stack is like this
b
c
and then, second c, skip it; now 'a' is coming,
'a' is bigger than 'b', but b does have any number to skip; need to put 'a' in anyhow.

the output will be "bca";

2. Try another one:
babcac
First one, b, go into the stack:
b,
meet a, and then, 'a' <'b', because b still have one to skip, so pop out b, skip the b, push 'a' in the stack;
Now, another b is coming, we have to hold one b in output, push it in the stack:
b
a
And then, c is coming, push it in c.
c
b
a

Now, a is coming, skip it; c is coming, also skip it.

the result is 'abc', smallest one in lexical sense.

3. Try third one:
work on first test case, make small change. move bbccaa, one of b, so the string is ccbaab,
c - put in the stack
c - skip it.
b - compare to stack top, b ( b has one left to skip);
so b into stack
b
c

c- second c, skip it
a- compare to the stack top: b
'a'<'b', still 'b' can skip one, one more is coming
pop up b, push a in,
a
c
and then, last char 'b' into stack
b
a
c
the output is "cab"

The question is to ask yourself, do you have genius to design it at the beginning, called thinking about in stack to cover mistake in greedy approach! Julia has no clue right now, she spent 9 hours to take this lesson. Backtracking is better term for using stack in the design.

April 5, 2016
Go over a2b2c2 case, the lexical smallest substring (Julia's first practice):
bccaba,
visit first 'b', skip 'b', because a has 2 of them to visit
visit first 'c', skip 'c',
visit second 'c', cannot skip, has to take it. Now, best one is starting from c, of course it is worse than the one starting from 'b', such as "bca".

So, greedy algorithm is to take what ever you can, and then, backtracking, make it smaller iteratively.
--
code source:  a box employee



HackerRank: string algorithm - Reverse Shuffle Merge (III)

April 3, 2016


Study the code written by some one in Google, need to get the idea how it is designed. It should not be difficult, since I already worked on this problem over 10 hours.

https://goo.gl/Rbh3B4


up to April 3, 2016
statistics:    1300 score 50.00 
Julia score rank:  1403
C# rank: 58

10-000 hour rule

April 3, 2016

  Share this article:
http://goo.gl/jnQ3qf

 10,000 hour rules - it is encouraging, keep going; learn to be mental strong; Do not get nervous when you are in trial.

 To entertain this 10,000 hour rule (better grammer: “10,000-hour rule”), Julia make a rule for herself, as a software programmer: called a new explainable variable or function rule - when you want to use Ctrl+C; or short name: Ctrl+C rule.

 This rule is for fast coding, people want to be a hacker. Let hand typing catches your mind quickly.