
誓必精通leetcode算法
leetcode算法
誓必精通leetcode所有算法
普通网友
这个作者很懒,什么都没留下…
展开
-
leetcode算法实例---组合和枚举问题
给定一列数(未排序)和一列目标值, 找出唯一的一个组合和等于目标值的组合, 数组中的数不能重复使用.算法思路: 使用递归.对数组排序, 从小到大; 令i = 起始下标(初始为0), 对于每一个数, 如果它等于目标值, 则在缓存结果中加入此数并将缓存结果加入输出队列, 随后在缓存结果中删除此数; 如果它小于目标值, 则在缓存结果中加入此数并递归调用此算法, 目标值更新为差值, 起始下标为i;原创 2017-08-23 09:56:37 · 1097 阅读 · 0 评论 -
算法研究之合并两个已排序的数组java版
package com.zken.test;/** * @author iamzken * 2015-8-28 * 合并两个有序数组 * */public class Sorter2 {public static void merge2SortedArray(int[] a , int[] b , int[] c){//a数组的当前索引i原创 2015-08-28 09:56:06 · 3202 阅读 · 0 评论 -
算法研究之快速排序java版
很早之前就已经接触过快速排序算法了,面试当中也屡屡被问到,虽然明白其原理,但从未真正的用代码敲出来。写关于算法的代码之前一定要原理想明白,不然就是盲目,在参考有关资料及自己的沉思之后,写出如下代码,中间出现了一些bug,但都很快解决了如果有更好的优化算法,还请不吝赐教!!!!源代码:package com.zken.test;/** * @author iamzken * 排序算法 *原创 2015-08-27 13:58:36 · 933 阅读 · 0 评论 -
leetcode算法之Valid Anagram
原文算法说明如下:Given two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram", t = "nagaram", return true.s = "rat", t = "car", return false.翻译:原创 2015-08-04 16:22:41 · 877 阅读 · 0 评论 -
leetcode数据库sql之Rising Temperature
leetcode原文引用:Given a Weather table, write a SQL query to find all dates' Ids with higher temperature compared to its previous (yesterday's) dates.+---------+------------+------------------+原创 2015-08-04 17:41:23 · 1017 阅读 · 0 评论 -
leetcode数据库sql之Department Top Three Salaries
leetcode原文引用:How would you print just the 10th line of a file?For example, assume that file.txt has the following content:Line 1Line 2Line 3Line 4Line 5Line 6Line 7Line 8Line 9Lin原创 2015-08-04 22:56:57 · 1081 阅读 · 0 评论 -
leetcode数据库sql之Delete Duplicate Emails
leetcode原文引用:Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique emails based on its smallest Id.+----+------------------+| Id | Email原创 2015-08-05 21:46:45 · 949 阅读 · 0 评论