摘要: 大家都知道斐波那契数列,现在要求输入一个整数n,请你输出斐波那契数列的第n项。public class Solution {public int Fibonacci(int n) {int target=0;if(n==0)return 0;if(n==1)return 1;int one=0;in... 阅读全文
posted @ 2015-12-28 22:02 小飞虫子 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 题目描述用两个栈来实现一个队列,完成队列的Push和Pop操作。 队列中的元素为int类型。import java.util.Stack;public class Solution {Stack stack1 = new Stack();Stack stack2 = new Stack();publ... 阅读全文
posted @ 2015-12-28 21:24 小飞虫子 阅读(394) 评论(0) 推荐(0) 编辑
摘要: What will be printed when you execute the following code?class C { C() { System.out.print("C"); }}class A { C c = new C(); A() { this("A"); Syst... 阅读全文
posted @ 2015-12-28 13:50 小飞虫子 阅读(191) 评论(0) 推荐(0) 编辑