![](https://img-blog.csdnimg.cn/20190918140053667.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
算法&设计
算法&设计
hecr_mingong
这个作者很懒,什么都没留下…
展开
-
外观模式(门面模式)
1.实现类目录结构:形状接口:package com.hcr.appearance;/** * 形状的接口 */public interface IShape { void draw();}圆实现类:package com.hcr.appearance;import org.springframework.stereotype.Component;/** * 圆 */@Componentpublic class Circle implements IShap原创 2020-05-28 00:04:27 · 313 阅读 · 0 评论 -
数组和字符串笔记02 - 二维数组
1.旋转矩阵题目: https://www.jianshu.com/p/add62418ee0ademo: public static void rotate(int[][] arr) { int length = arr.length; int[][] newArr = new int[length][length]; for (int i = 0; i < length; i++) { for (int j = 0原创 2021-11-16 21:17:10 · 189 阅读 · 0 评论 -
数组和字符串笔记01 - 数组
1.寻找数组的中心索引demo: /** * 寻找数组的中心索引 * 思路:先计算和; * 左边和 + 右边和 + 当前索引数值 = 总和 * 因为左边和要等于右边和,所以2 * 左边和 + 当前索引值 = 总和 */ private static int getCenterIndex(int[] arr) { int sum = Arrays.stream(arr).sum(); int length =原创 2021-11-15 20:49:45 · 385 阅读 · 0 评论