摘要: Given a stream of integers and a window size, calculate the moving average of all integers in the sliding window. For example, MovingAverage m = new M 阅读全文
posted @ 2019-12-12 14:21 yaphse 阅读(573) 评论(0) 推荐(0)
摘要: 题目的英文版是这样的: You are given a m x n 2D grid initialized with these three possible values. 1 A wall or an obstacle. 0 A gate. INF Infinity means an empty 阅读全文
posted @ 2019-12-12 17:44 yaphse 阅读(562) 评论(0) 推荐(0)
摘要: 题目来源:力扣(LeetCode) 链接:https://leetcode cn.com/problems/perfect squares 给定正整数 n,找到若干个完全平方数(比如 1, 4, 9, 16, ...)使得它们的和等于 n。你需要让组成和的完全平方数的个数最少。 示例 1: 输入: 阅读全文
posted @ 2019-12-12 00:20 yaphse 阅读(97) 评论(0) 推荐(0)
摘要: 题目来源:力扣(LeetCode) 链接:https://leetcode cn.com/problems/open the lock 你有一个带有四个圆形拨轮的转盘锁。每个拨轮都有10个数字: '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' 。每个 阅读全文
posted @ 2019-12-12 00:13 yaphse 阅读(284) 评论(0) 推荐(0)
摘要: java设计模式之单例模式 一 定义: ​ 单例模式保证类在整个项目中仅有一个实例,并提供一个全局访问该实例的方法。 二 单例模式的两种实现方式:懒汉模式和饿汉模式 ~~~java / 懒汉模式 / public class Singleton{ //定义一个变量来存储实例 private stat 阅读全文
posted @ 2019-08-05 23:04 yaphse 阅读(87) 评论(0) 推荐(0)