![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Algorithm
wenniuwuren
Winter is coming
展开
-
LeetCode ---- Fizz Buzz (Java/Lua 实现)
题目: Write a program that outputs the string representation of numbers from 1 to n. But for multiples of three it should output “Fizz” instead of the number and for the multiples of five outp原创 2016-10-20 20:34:11 · 2970 阅读 · 0 评论 -
LeetCode ---- Single Number (Java/Lua 实现)
问题: Given an array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without us原创 2016-10-17 20:21:44 · 712 阅读 · 0 评论 -
LeetCode ---- Nim Game (Java/Lua 实现)
题目: You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone wi原创 2016-10-17 10:54:10 · 903 阅读 · 0 评论 -
LeetCode ---- Two Sum (Java Lua 实现)
题目: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution. Example: Giv原创 2016-10-14 17:35:39 · 835 阅读 · 0 评论 -
LeetCode ---- Find the Difference (Java/Lua 实现)
题目: Given two strings s and t which consist of only lowercase letters. String t is generated by random shuffling string s and then add one more letter at a random position. Find the lette原创 2016-10-24 13:43:34 · 1161 阅读 · 0 评论 -
LeetCode ---- Add Digits (Java/Lua 实现)
题目: Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Sin原创 2016-10-21 17:00:53 · 772 阅读 · 0 评论 -
位图排序
第一次听说位图排序是在上操作系统课的时候, 当时也没太在意, 就是觉得存储挺方便。 最近看《编程珠玑》开篇就将到位图排序, 那么有缘就来实现下。 优势: 在数据集集中分布的情况下, 运行时间比一般的排序快挺多。 是一个典型的空间换时间的算法。 劣势: 在数据集稀疏分布的情况下, 运行时间不会差太多。 而且得事先知道要处理的数据最大值, 才好定义辅助属性的大小。原创 2015-01-03 10:58:32 · 1510 阅读 · 0 评论 -
沿对角线打印矩阵
这好像是美团的一道面试题...原创 2015-01-09 11:24:24 · 2872 阅读 · 0 评论