算法&设计
算法&设计
hecr_mingong
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
外观模式(门面模式)
1.实现类 目录结构: 形状接口: package com.hcr.appearance; /** * 形状的接口 */ public interface IShape { void draw(); } 圆实现类: package com.hcr.appearance; import org.springframework.stereotype.Component; /** * 圆 */ @Component public class Circle implements IShap原创 2020-05-28 00:04:27 · 372 阅读 · 0 评论 -
数组和字符串笔记02 - 二维数组
1.旋转矩阵 题目: https://www.jianshu.com/p/add62418ee0a demo: 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 · 221 阅读 · 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 · 417 阅读 · 0 评论
分享