自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(12)
  • 资源 (3)
  • 收藏
  • 关注

转载 C++ Memory Management C++ 内存管理

ProblemC++ has several distinct memory areas where objects and non-object values may be stored, and each area has different characteristics.Name as many of the distinct memory areas as you can. Fo

2015-08-12 04:41:23 992

原创 [LeetCode] 01矩阵中最大正方形 Maximal Square

Given a 2D binary matrix filled with 0's and 1's, find the largest square containing all 1's and return its area. For example, given the following matrix:1 0 1 0 01 0 1 1 11 1 1 1 11 0 0 1 0Re

2015-08-04 03:48:44 8960

原创 [LeetCode] Shortest Palindrome I

相关问题1:最长回文子串相关问题2:Minimum insertions to form a palindromeGiven a string S, you are allowed to convert it to a palindrome by adding characters in front of it. Find and return the shortest pal

2015-08-03 11:13:52 890

原创 Minimum insertions to form a palindrome

给你一个字符串S,插入一些字符,把 S 转换成一个回文字符串。例如:ab: Number of insertions required is 1. babaa: Number of insertions required is 0. aaabcd: Number of insertions required is 3. dcbabcdabcda: Number of inser

2015-08-03 11:12:18 1034

原创 [LeetCode] Count Complete Tree Nodes

Given a complete binary tree, count the number of nodes.思路:找到最左边的节点和最右边的节点,如果二者高度一致,那么说明最后一层是满的,返回2^h-1。否则,递归下去。代码: int countNodes(TreeNode* root) { if(!root) return 0;

2015-08-03 10:16:06 605

原创 [LeetCode] Fraction to Recurring Decimal

Given two integers representing the numerator and denominator of a fraction, return the fraction in string format. If the fractional part is repeating, enclose the repeating part in parentheses. For e

2015-08-03 06:44:33 598

原创 [LeetCode] Best Time to Buy and Sell Stock VI

相关问题:给你一个数组,数组的每个元素表示每天的stock价格,你最多可以进行k次交易,两次交易不能在时间上重叠,也就是说,你必须先卖掉股票,才能再买入股票。求可以获得的最大利润。 思路:利用动态规划。这里我们需要两个递推公式来分别更新两个变量local和global,参见网友Code Ganker的博客,我们其实可以求至少k次交易的最大利润。我们定义local[i][j]为在到达第i

2015-08-03 05:16:40 555

原创 [LeetCode] Best Time to Buy and Sell Stock III

相关问题:[LeetCode] Best Time to Buy and Sell Stock II给你一个数组,数组的每个元素表示每天的stock价格,你最多可以进行2次交易,两次交易不能在时间上重叠,也就是说,你必须先卖掉股票,才能再买入股票。求可以获得的最大利润。该问题还可以扩展为:把最多2次交易的条件,改成最多k次交易。相关问题:

2015-08-03 03:34:52 529

原创 Find maximum repeating number

给你一个长度是n的整数数组,数组中数字的范围是 [0, k-1] ,  k 满足 k思路1:用计数排序的方法,把数组排序,然后找到最大的重复出现的数字。思路2:假如给定arr[] = {2, 3, 3, 5, 3, 4, 1, 7}, k = 8, n = 8。那么,Iterate though input array arr[], for every

2015-08-03 02:32:47 478

原创 [LeetCode] Insert Interval 插入区间

Given a set of non-overlapping intervals, insert a new interval into the intervals (merge if necessary). You may assume that the intervals were initially sorted according to their start times.Exam

2015-08-02 23:18:36 582

原创 字符串旋转-回文字符串

相关问题:最长回文子串给你一个字符串,求问,这个字符串旋转之后是不是一个回文字符串?例如:给你字符串 str = "aaaab",那么str旋转之后可以得到 str_new = "aabaa",是个回文字符串。思路:可以把str和str接起来,得到“aaaabaaaab”,然后对"aaaabaaaab"求最长回文字符子串。利用Machester算法,复杂度是O(n).

2015-08-02 03:29:44 665

原创 Egg Drop 扔鸡蛋

假设有 n=2 个完全一样的鸡蛋, 有 k=36 层楼。 存在一个楼层 m,把鸡蛋从低于m的楼层扔下去的时候,鸡蛋不会摔破;把鸡蛋从高于等于m的楼层扔下去的时候,鸡蛋会摔破。题目要求,找出临界楼层m,并且扔鸡蛋的次数要做到最少。思路:最简单的方法是,从第 1 层往上,一层一层 的扔鸡蛋,直到鸡蛋摔碎。这样需要扔鸡蛋 m 次。下面用递归的方法解决该问题。假设鸡蛋从 x 层扔下去。(1)如

2015-08-01 23:44:20 2612 1

Monte carlo模拟的Mathematica代码

本文件是用Mathematica代码编写的Monte carlo模拟。 包含均匀分布,指数分布,以及均匀分布在圆和球面上的点。

2010-04-10

网格搜索法--求公切线算法

网格搜索法--求公切线算法。Mathematica程序。

2009-07-08

北邮通信电子电路自测题

这是本人在北邮学习期间,搜集的通信电子电路自测题。老师给的。很有价值。

2009-07-08

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除