
算法题
wankunde
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Balanced Binary Tree
Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never diffe原创 2015-01-27 16:56:41 · 803 阅读 · 0 评论 -
Anagrams
Given an array of strings, return all groups of strings that are anagrams. 注意 All inputs will be in lower-case 样例 Given a string list: ["lint","intl","inlt","code"] return ["l原创 2015-01-23 13:36:33 · 694 阅读 · 0 评论 -
A + B Problem
For given numbers a and b in function aplusb, return the sum of them. 注意 You don't need to parse the input and output. Just calculate and return. 样例 If a=1 and b=2 return 3 挑战原创 2015-01-23 11:39:52 · 729 阅读 · 2 评论 -
Binary Tree Inorder Traversal
Given a binary tree, return the inorder traversal of its nodes' values. 样例 Given binary tree {1,#,2,3}, 1 \ 2 / 3 return [1,3,2]. 挑战 Can you do it with原创 2015-01-23 22:46:02 · 561 阅读 · 0 评论 -
Binary Search
Binary search is a famous question in algorithm. For a given sorted array (ascending order) and a target number, find the first index of this number in O(log n) time complexity. If the target nu原创 2015-01-23 21:11:53 · 831 阅读 · 0 评论 -
Backpack
Given n items with size A[i], an integer m denotes the size of a backpack. How full you can fill this backpack? 注意 You can not divide any item into small pieces. 样例 If we have 4 items原创 2015-01-23 18:35:28 · 2235 阅读 · 0 评论 -
Copy List with Random Pointer
A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep copy of the list. 解题思路: 思路一:创建链表拷贝,同时使用一个Map存原创 2015-02-11 12:33:15 · 714 阅读 · 0 评论 -
Clone Graph
Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ's undirected graph serialization: Nodes are labeled uniquely. We use # as a separator for ea原创 2015-01-26 18:02:46 · 513 阅读 · 0 评论 -
Best Time to Buy and Sell Stock III
Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may complete at most two transactions. 注意 You may n原创 2015-01-28 12:17:45 · 752 阅读 · 0 评论 -
Combination Sum
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 repeated number may be chosen from C unlimited numb原创 2015-01-29 19:28:54 · 778 阅读 · 0 评论 -
4 Sum
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target. Note Elements i原创 2015-02-05 15:36:11 · 1126 阅读 · 0 评论 -
趣写算法系列之--匈牙利算法 Java实现
【书本上的算法往往讲得非常复杂,我和我的朋友计划用一些简单通俗的例子来描述算法的流程】 匈牙利算法是由匈牙利数学家Edmonds于1965年提出,因而得名。匈牙利算法是基于Hall定理中充分性证明的思想,它是部图匹配最常见的算法,该算法的核心就是寻找增广路径,它是一种用增广路径求二分图最大匹配的算法。 -------等等,看得头大?那么请看下面的版本: 通原创 2015-01-22 15:10:07 · 2480 阅读 · 0 评论 -
网站统计中的数据收集原理及实现
转自:http://blog.codinglabs.org/articles/how-web-analytics-data-collection-system-work.html 网站数据统计分析工具是网站站长和运营人员经常使用的一种工具,比较常用的有谷歌分析、百度统计和腾讯分析等等。所有这些统计分析工具的第一步都是网站访问数据的收集。目前主流的数据收集方式基本都是基于javas转载 2016-03-30 16:38:11 · 860 阅读 · 0 评论