
java常用算法
爱上双眼皮儿的猫
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
java常用算法之返回字符串中目标字符串的位置
/** * @Description 返回字符串中目标字符串的位置 * @param str * @return */ public static Integer strStr(String str, String target) { int length = str.length(); int targetLength = target.length(); if (原创 2016-04-18 13:33:12 · 950 阅读 · 1 评论 -
java常用算法之两个有序list的合并
/** * 两个已顺序排序数组的合并 * * @param aList * @param bList * @return */ public static List mergeTwoSortList(List aList, List bList) { int aLength = aList.size(), bLength = bList.size(); L原创 2016-04-18 11:13:28 · 5570 阅读 · 1 评论 -
java常用算法之字梯(广度优先搜索bfs)
package utils;import java.util.HashMap;import java.util.HashSet;import java.util.LinkedList;import java.util.Queue;import com.google.gson.Gson;public class WordLadder { // solution function原创 2016-02-16 17:17:23 · 671 阅读 · 0 评论 -
java常用算法之逆波兰表达式(Evaluate Reverse Polish Notation)
public class Test { public static void main(String[] args) throws IOException { String[] tokens = new String[] { "2", "1", "+", "3", "*" }; System.out.println(evalRPN(tokens)); } public sta原创 2016-02-16 15:02:07 · 754 阅读 · 0 评论 -
java判断字符串是否包含中文
public static boolean checkChinese(String sequence) { final String format = "[\\u4E00-\\u9FA5\\uF900-\\uFA2D]"; boolean result = false; Pattern pattern = Pattern.com原创 2016-02-16 13:55:50 · 710 阅读 · 1 评论 -
java常用算法之返回目标数字在有序数组中的位置(假设有序数组中不存在重复数字)
/** * @Description 返回目标数字在有序数组中的位置(假设有序数组中不存在重复数字) * @param source * @param target * @return */ public static Integer numIndex(int[] source, int target) { int index = 0; if (source ==原创 2016-04-18 13:52:47 · 515 阅读 · 0 评论 -
java常用算法之螺旋矩阵
给定一个m*n矩阵,返回所有元素在矩阵中的螺旋序列,例如:原创 2016-04-19 14:05:24 · 1504 阅读 · 0 评论