Interleaving String

Description Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example, Given: s1 = "aabcc", s2 = "dbbca", When s3 = "aadbbcbcac", return true. When s3 = "aadbbbaccc", return false. Analysis The...

Distinct Subsequences

Description Sort a linked list in time using constant space complexity. Analysis We can solve this problem with DP solution. Here we use to represent the number of sub-string appearing in string . So if , then we know and...

Survey Desigin Tips

General Tips Tools Questions and answers Survey with MTurk

Sort List

Description Sort a linked list in time using constant space complexity. Analysis It is better to solve this problem with MergeSort than QuickSort, as we do not enjoy random access in a linked list. The easiest way to implement MergeSort...

Merge Interval

Description https://oj.leetcode.com/problems/merge-intervals/ Difficulty: 1 star Analyssis Nothing special. Solution bool myfunc(Interval in1, Interval in2){ if (in1.start < in2.start) return true; else if(in1.start == in2.start && in1.end < in2.end) return true; return false; } class Solution { public: vector<Interval> merge(vector<Interval> &intervals)...