码迷,mamicode.com
首页 >  
搜索关键字:the maximum number o    ( 30279个结果
二分查找需要注意的Bug
#include #include using namespace  std; //下面一个移位是一样的,>>相当于除去2,主要是要用right-left,否则对于大数据来说会产生溢出问题。切记 int binarySearch(int arr[],int len,int number) {     int left=0;     int right=len-1;     in...
分类:其他好文   时间:2014-05-15 07:14:38    阅读次数:272
[LeetCode]ZigZag Conversion
Write the code that will take a string and make this conversion given a number of rows: P A H N A P L S I I G Y I R convert("PAYPALISHIRING", 3) should return "PAHNAPLSIIGYIR"....
分类:其他好文   时间:2014-05-15 04:49:04    阅读次数:311
LeetCode-001 Two Sum
LeetCode-001 Two Sum Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers such that they add up to the target, where index1 must be less than index2...
分类:其他好文   时间:2014-05-15 04:34:50    阅读次数:293
LeetCode 006 ZigZag Conversion
【题目】 The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility) P A H N A P L S I I G Y I R And then read line by line: "PAHNAPLSI...
分类:其他好文   时间:2014-05-15 04:30:57    阅读次数:313
【LeetCode】Plus One
题目 Given a non-negative number represented as an array of digits, plus one to the number. The digits are stored such that the most significant digit is at the head of the list. 解答 本题考察进位问题,注...
分类:其他好文   时间:2014-05-15 04:16:56    阅读次数:245
LeetCode-005 Longest Palindromic Substrin
【题目】 Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring. 【题意】 题意是找出字符串S中最长回文子串,S最长为1000,保证有唯一解 【思路】 原字符串用特殊字符#间隔,如下所示: #a...
分类:其他好文   时间:2014-05-15 03:31:25    阅读次数:299
向linux内核添加系统调用新老内核比较
2.6内核 1>修改linux-source-2.6.31/kernel/sys.c文件,在文件末尾添加系统响应函数。函数实现如下: asmlinkage int sys_mycall(int number)   {     printk("这是我添加的第一个系统调用");     return number;  } 2>在linux-source-2.6.31...
分类:系统相关   时间:2014-05-15 02:51:56    阅读次数:382
Leetcode 动态规划 Maximum Subarray
题意:最大连续子序列和,在一个数组中找到和最大的连续子数组 思路:dp, 对于第i个数,有两种选择:把它加入在子数组里,不加入子数组(子数组到此结束) 加不加入子数组,要比较它加入前后子数组的总和是变大了还是变小了,如果变大则加入,变小则不加入 所以,我们需要记录以i-1结尾的子数组的总和,最后的结果在这些总和中取最大的那个 f[i] = max(f[i-1]+a[i],f[i-1]); max({f[i]}) 实现时用两个变量,一个保存f[i-1],一个保存目前为止最大的f[i] 复杂度:时间O(n),空...
分类:其他好文   时间:2014-05-14 21:53:14    阅读次数:250
【原创】MySQL 以及 Python 实现排名窗口函数
大部分数据库都提供了窗口函数,比如RANK,ROW_NUMBER等等。MySQL这方面没有直接提供,但是可以变相的实现,我以前写了row_number的实现,今天有时间把rank的实现贴出来。这里,我用MySQL以及Python分别实现了rank窗口函数。原始表信息:t_girl=#\dgroup_concat; Table"ytt.grou..
分类:数据库   时间:2014-05-14 17:04:57    阅读次数:442
黑马程序员——基础加强篇
-------android培训、java培训、期待与您交流!----------MyEclipse相关知识Workspace与project切换工作空间:File---SwitchWorkspace---Other一个工作间包含多个工程,切换工作间之后,会影响里面的工程,例如快捷键什么的都要重新配置如果重新配了之后快捷键还没有用就要考虑..
分类:其他好文   时间:2014-05-14 17:01:52    阅读次数:304
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!