n0 = n2 +1
原因:n0:葉子結點個數,S結點總數
結點方面考慮:n0+n1+n2 = S
樹枝方面考慮:0*n0 +1*n1 +2*n2 = S-1(分十塊豆腐砍九刀)
n0 = n2 +1
原因:n0:葉子結點個數,S結點總數
結點方面考慮:n0+n1+n2 = S
樹枝方面考慮:0*n0 +1*n1 +2*n2 = S-1(分十塊豆腐砍九刀)
原文 public int climbStairs(int n) { double sqrt5=Math.sqrt(5); double fibn=Math.pow((1+sqrt5)/2,