@reeclapple What is the worst case time complexity for your BFS + DFS solution?
kool
@kool
Posts made by kool

RE: Share two similar Java solution that Accpted by OJ.

Time complexity to generate all combinations of wellformed parentheses.
Generating all combinations of well formed paranthesis is a typical example of catalan numbers. You can use the links at the bottom here if you are not aware of the catalan numbers since they are at the heart of the exercise.
Let time complexity for the generating all combinations of wellformed parentheses is f(n), then
f(n) = g(n) * h(n) where g(n) is the time complexity for calculating nth catalan number, and h(n) is the time required to copy this combination to result array.
Therefore, f(n) = catalan(n) * O(n) which is O(4^n/n^1.5)*(n)). Broadly saying just remember that this is a typical example of catalan number and it's time complexity is similar to how catalan(n) is got.
Further readings in to catalan numbers:
https://en.wikipedia.org/wiki/Catalan_number
https://www.youtube.com/watch?v=GlI17WaMrtw
https://www.youtube.com/watch?v=eoofvKI_Okg 
RE: Python O(n) 1 pass inplace solution with explanation
@IWantToPass Have a look at the diagrams here to get a better understanding of it.
http://www.geeksforgeeks.org/sortanarrayof0s1sand2s/ 
RE: Median of two sorted arrays
Can someone explain possibly with an example, how we assumed or concluded i=0∼m, j=(m+n+1)/2 − i ?
I got how i+j=m−i+n−j (or: m  i + n  j + 1m−i+n−j+1) part but couldn't get my head around j = (m+n+1)/2 − i. 
RE: Sum of Count of Different bits
It's actually similar to finding total hamming distance.
https://leetcode.com/problems/totalhammingdistance/#/description