摘要: 题目描述 大家都知道斐波那契(Fibonacci)数列,现在要求输入一个整数n,请你输出斐波那契数列的第n项(从0开始,第0项为0,第1项是1)。 要求使用递归和非递归两种方法 1.递归实现 时间复杂度:O(2n) ,空间复杂度:O(1) public class Solution { public 阅读全文
posted @ 2020-05-13 22:39 不学无墅_NKer 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 1 class Solution { 2 public int firstUniqChar(String s) { 3 4 int[] freq = new int[26]; 5 for(int i = 0; i < s.length(); i ++){ 6 freq[s.charAt(i) - ' 阅读全文
posted @ 2020-05-13 21:19 不学无墅_NKer 阅读(117) 评论(0) 推荐(0) 编辑