Problem Description You will be given a string which only contains '1'; You can merge two adjacent '1' to be '2', or leave the '1' there. Surly, you may get many different results. For example, given 1111 , you can get 1111, 121, 112,211,22. Now, you…
Triangle Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 127 Accepted Submission(s): 89 Problem Description Mr. Frog has n sticks, whose lengths are 1,2, 3⋯n respectively. Wallice is a bad ma…
斐波拉契数列是指这样一个数列: F(1)=1; F(2)=1; F(n)=F(n-1)+F(n); public class Solution { public int Fibonacci(int n) { int preNum = 1; int prePreNum = 0; int result = 0; if(n ==0){ return 0; } if(n == 1){ return 1; } for(int i = 2; i <= n; i ++){ result = preNum +…