随笔分类 -  算法

针对一百万以内数据高频变化、聚合统计、实时性要求的解决方案
摘要:背景需求: 解决方法程序: package org.mem; import java.util.*; public class Test1 { public static void main(String[] args) { final Map<String,Moci> map = new Hash 阅读全文

posted @ 2021-11-08 18:35 李雷 阅读(214) 评论(0) 推荐(0)

从一整数数组中找出只重复一次的两个数
摘要:概述 有一整数数组,所有数都重复了两次,只有两个数重复了一次,找出这两个数,要求空间复杂度为O(1),时间复杂度O(n) 代码 阅读全文

posted @ 2017-11-16 10:16 李雷 阅读(245) 评论(0) 推荐(0)

Edit Distance 最小编辑距离
摘要:概述 Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.) You ha 阅读全文

posted @ 2017-11-16 09:35 李雷 阅读(182) 评论(0) 推荐(0)

求和数组项值,使其等于某个目标值
摘要:描述 Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same rep 阅读全文

posted @ 2017-11-15 17:15 李雷 阅读(758) 评论(0) 推荐(0)

求数组三项之和最接近某个目标数字
摘要:描述 Given an array S of n integers, find three integers in S such that the sum is closest toa given number, target. Return the sum of the three integer 阅读全文

posted @ 2017-11-15 13:57 李雷 阅读(361) 评论(0) 推荐(0)

快速排序
摘要:概述 快速的升序排列(注意边界) 代码 阅读全文

posted @ 2017-11-15 09:40 李雷 阅读(174) 评论(0) 推荐(0)

合并排序
摘要:概述 合并的升序排列 代码 阅读全文

posted @ 2017-11-14 15:51 李雷 阅读(143) 评论(0) 推荐(0)

冒泡排序
摘要:概述 冒泡升序排列 代码 阅读全文

posted @ 2017-11-14 15:36 李雷 阅读(158) 评论(0) 推荐(0)

选择排序
摘要:概述 选择的升序排列 代码 阅读全文

posted @ 2017-11-14 15:21 李雷 阅读(109) 评论(0) 推荐(0)

插入排序
摘要:概述 递增方式插入排序 代码 阅读全文

posted @ 2017-11-14 15:12 李雷 阅读(128) 评论(0) 推荐(0)

最大堆排序
摘要:package com.lilei.geotools.app_geotools; import java.util.Random; public class MaxHeapSort { public static void main(String[] args) { int[] array = new int[10000000]; for (int i = 0; i 0; ... 阅读全文

posted @ 2017-11-10 09:15 李雷 阅读(150) 评论(0) 推荐(0)

Container With Most Water 容器最大水容量
摘要:描述 Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two en 阅读全文

posted @ 2017-11-08 14:10 李雷 阅读(492) 评论(0) 推荐(0)

全排列Permutations
摘要:描述 Given a collection of numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2,1,3], [2,3 阅读全文

posted @ 2017-11-08 10:05 李雷 阅读(213) 评论(0) 推荐(0)

Generate Parentheses
摘要:描述 Given n pairs of parentheses, write a function to generate all combinations of wellformed parentheses.For example, given n = 3, a solution set is:" 阅读全文

posted @ 2017-11-07 16:27 李雷 阅读(164) 评论(0) 推荐(0)

导航