Tuesday, July 5, 2016

Facebook code lab - daily coding practice

July 5, 2016

Spend 30 minutes a time, choose to work on facebook code lab.

Julia's new favorite place to get training daily:

https://codelab.interviewbit.com/

Try to write code without compiler error, executable code. 

Favorite practice: 
1. GCD - great common denominator 

   https://gist.github.com/jianminchen/631086210db7c41fcdda677c3aaf726c

Things to work on: No run-time exception
line 47 - 48
if (b == 0) // bug001 - forget to check if(b==0) first writing, not reaching facebook coding requirement!
return a;

// bug001 - forget to check if(b==0) first writing!

2. is same tree
https://gist.github.com/jianminchen/2c55d67226b86d38f4158160801b82ff

3. Number 1 bits
https://gist.github.com/jianminchen/d2f6022094fcdb41fb7e7cae8b30c725

things to work on: No compiler's help

line 37: a = a >> 1; // bug001 - writing, forget
"a =" in first writing, need compiler's help

Blog reading:

https://zhuanlan.zhihu.com/p/20941886?refer=qinchao

DDD - Debugger Driven Development
PDD - Print Driven Development 
BDD - Bug-Driven Development 
RDD - Rat-Race-Game-Driven Development

DDD - Deadline-Driven Development 


No comments:

Post a Comment