Code Solution Click : http://ideone.com/7M1o9j
2) http://www.hackerearth.com/problem/algorithm/good-times-vs-bad-times-3/
Code Solution Click : http://ideone.com/xj7o49
After few days F2F is scheduled….
Face to Face Interview :
1) About my current work, Discussion on current work
2) Very deep Discussion about my B.Tech and M.Tech Projects and Research Work.
3) As I know sql injection, he asked several questions on sql injection, why it happens and how etc just to check my knowledge in it.
4) Simply started with Fibonacci Series code
wrote recursive solution and then wrote solution which uses memorization technic in O(n) with
space complexity O(n)
Then incremental solution in O(n).
with
while(i<n){
a=1;
b=1;
c=a+b;
a=b;
b=c;
i++
}
print c;
Then he wished to create same solution (above one) with recursion. that modification also I did.
Then he wanted Previous Recursive solution
with F(n) = F(n-1)+F(n-2) in O(n) but without using Space or Memorization.
As I could not do, He suggested me to use Accumulator, for that also I was not aware.
4) Then Interviewer Asked me question on “Minimum insertions to form a palindrome”
Solution check : http://www.geeksforgeeks.org/dynamic-programming-set-28-minimum-insertions-to-form-a-palindrome/
Which I partially could’not , as DP solutions are tricky,
but he liked the approach I was doing, and he saw code for it.
5) Question on SQL left joins.
Late in evening I got call for Rejection :(