classSolution{privatestaticfinalint[]sumArray=newint[100000+1];publicintsolution(intn){// Retrun for 0, 1if(n==0){return0;}elseif(n==1){return1;}// Check sumArray and Sumif(sumArray[n]!=0){returnsumArray[n]%1234567;}else{intsum=solution(n-1)+solution(n-2);sumArray[n]=sum;returnsum%1234567;}}}