CnyrdSnyrd
BAN USERThe same logic can be easily extended to store num of paths at i,j. Path[i][j] = Path[i+1][j] + Path[i][j+1];
 CnyrdSnyrd February 17, 2013PATH array stores 1 if there exists a path from i,j to N,M using only rightward and downward directions else 0
Initialize PATH to all zeros.
PATH[N1][M1] = 1;
for i in N1 to 0:
for j in M1 to 0:
if(i<N1):
PATH[i][j] = PATH[i+1][j];
if(j<M1):
PATH[i][j] = PATH[i][j]  PATH[i][j+1];
PATH[i][j] = PATH[i][j] & bool[i][j];
check PATH[0][0];

CnyrdSnyrd
February 16, 2013 Chrome stores everything in separate process, which implies that the parent process would keep a hashMap of all the process. The key would the index and value woud be the process. The process would provide the details with regard to tabcontent. Movement of tabs is just swaping of hashkeys.
Each tab is a proces and have URLHandler. The handler would call a factory of protocol, such as httpFactory, ftpFactory etc. Each protocol handler will call have a retrievingengine and renderingengine. The browser would retrieve and render using factory.
public class MyIterator<T>{
T[] arr;
int currPos;
int negPos;
int size;
public boolean hasNext(){
for(int i = currPos+1; i<size;i++){
if(arr[i] < 0){
if(negPos != i) negPos = i;
return true;
}
}
return false;
}
public T next(){
if(hasNext()){
currPos = negPos;
return a[currPos];
}
return null;
}
}

CnyrdSnyrd
November 25, 2012
i think the question is talking about sequence not subsequence. Longest sequence can be calculated in O(n) time easily.
 CnyrdSnyrd February 04, 20143 4 6 is the correct ouput.