摘要: 1. Question 求1+2+3+...+n,要求不能使用乘除法、for、while、if、else、switch、case等关键字及条件判断语句(A?B:C)。 2. Solution 1. 利用构造函数求解 可以用构造函数求解,每次创建一个对象的时候都会去调用一次构造函数,那么我们就把静态变 阅读全文
posted @ 2017-06-28 17:19 清水汪汪 阅读(213) 评论(0) 推荐(0)
摘要: Question 给定一个数组和滑动窗口的大小,找出所有滑动窗口里数值的最大值。例如,如果输入数组{2,3,4,2,6,2,5,1}及滑动窗口的大小3,那么一共存在6个滑动窗口,他们的最大值分别为{4,4,6,6,6,5}; 针对数组{2,3,4,2,6,2,5,1}的滑动窗口有以下6个: {[2, 阅读全文
posted @ 2017-06-28 14:47 清水汪汪 阅读(221) 评论(0) 推荐(0)
摘要: 背景 来看一道leetcode题目: Implement strStr(). Returns the index of the first occurrence of needle in haystack, or 1 if needle is not part of haystack. 让我们找到第 阅读全文
posted @ 2017-06-28 10:50 清水汪汪 阅读(542) 评论(0) 推荐(0)