
算法笔记
文章平均质量分 77
夕虞
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
【算法笔记之数组】数组去重
数组去重思想: 利用set去重,再转化为数组 set是一个集合,其中的元素不能重复。 HashSet<Integer> hs=new HashSet<Integer>(); for(int i = 0;i<n;i++){ Integer t = scan.nextInt(); //从控制台...原创 2018-04-11 22:44:31 · 395 阅读 · 0 评论 -
【算法笔记之数组】二维数组旋转
二维数组旋转 //对数组顺时针旋转90度,返回数组temp[] public static int[][] convert(int[][] b) { int[][] temp = new int[b[0].length][b.length]; for (int i = 0; i < b.length; i++) {...原创 2018-04-11 22:47:13 · 871 阅读 · 0 评论 -
【算法笔记之字符串】字符串逆序及左移
1、求String的逆序//求逆序public static String reverse_toCharArray(String str){ StringBuffer sb = new StringBuffer(); char[] ch = str.toCharArray(); //转为字符数组 for(int i=ch.length-1; i>=0; i--...原创 2018-04-11 22:59:12 · 253 阅读 · 0 评论 -
【算法笔记之数组】找出数组中出现次数最多的数
找出数组中出现次数最多的数法一: 遍历计数法 //找出出现次数最多的数字 方法一 public static void candidate (int[] array) // 找出数组中出现次数最多的那个数 { int[] count = new int[101]; // 计数数组,每个元素的默认值为0 ...原创 2018-04-11 23:03:09 · 9549 阅读 · 1 评论