So, the New Year holidays are over. Santa Claus and his colleagues can take a rest and have guests at last. When two "New Year and Christmas Men" meet, thear assistants cut out of cardboard the letter...
分类:
其他好文 时间:
2014-07-22 23:03:53
阅读次数:
521
这道题在前两个的基础上做稍微改进就可以。下面是AC代码: 1 /** 2 * Design an
algorithm to find the maximum profit. You may complete at most two transactions.
3 * @pa...
分类:
其他好文 时间:
2014-07-22 23:01:13
阅读次数:
251
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a link...
分类:
其他好文 时间:
2014-05-01 22:08:19
阅读次数:
366
没有想通为什么这个简单的问题竟然不是那么简单,太小看它了,以下是两个别人的很不错的solution:Solution1:
1 public class Solution { 2 public int removeDuplicates(int[] A) { 3 // Start...
分类:
其他好文 时间:
2014-05-01 20:19:26
阅读次数:
384
You are given two linked lists representing two
non-negative numbers. The digits are stored in reverse order and each of their
nodes contain a single ...
分类:
其他好文 时间:
2014-05-01 20:18:54
阅读次数:
425
whether two nohead-linkedlist have the same end
个人信息:就读于燕大本科软件工程专业 目前大三;
本人博客:google搜索“cqs_2012”即可;
个人爱好:酷爱数据结构和算法,希望将来从事算法工作为人民作出自己的贡献;
博客内容:在无头节点的链表里删除元素;
博客时间:2014-4-15;
编程语言:C+...
分类:
其他好文 时间:
2014-05-01 18:13:31
阅读次数:
352
题目:
Given a sorted (increasing order) array, write an algorithm to create a binary tree with minimal height.
翻译:
给定一个有序数组(递增),写程序构建一棵具有最小高度的二叉树。
思路:
要使二叉树的高度最小,则要尽量使其左右子树的节点数目相当,自然就考虑到将其构造成为二叉排序树,且将有序数组的中间大的数作为根节点,这样得到的二叉树的高度便是最小的。...
分类:
其他好文 时间:
2014-05-01 17:48:45
阅读次数:
321
Merge k Sorted Lists
Total Accepted: 9746 Total
Submissions: 41674My Submissions
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity....
分类:
其他好文 时间:
2014-05-01 17:11:32
阅读次数:
234
给两个长度分别为n和m的序列,现在有两种操作:1.分别选择两个序列的一个非空前缀,切两个前缀的最后一位相同,删除之,得到1分(只累计),消耗e;2.直接删除两个序列,消耗值定于两个序列之前删除的元素个数之和,并且使得得到的分有效(之前没有有效分)
(1?≤?n,?m?≤?105; 1?≤?s?≤?3·105; 103?≤?e?≤?104),s代表总能量,e表示一次操作的消耗...
分类:
其他好文 时间:
2014-04-30 22:13:40
阅读次数:
261
Background:
It's fairly common for businesses to want to provide some high availability for their SQL Server databases, and one option is to have two SQL Server databases on separate machines with a SQL Server database mirrored....
分类:
数据库 时间:
2014-04-30 22:11:38
阅读次数:
520