码迷,mamicode.com
首页 >  
搜索关键字:sparse array    ( 29791个结果
leetcode——Two Sum 两数之和(AC)
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, whe...
分类:其他好文   时间:2014-06-09 23:14:45    阅读次数:264
ci框架数据库相关函数
返回查询影响的记录数 $res = $this->db->get_where('wx_life',array('id'=>$id)); $num = $res->num_rows();...
分类:数据库   时间:2014-06-09 23:10:50    阅读次数:259
转换MFC CString 到std::string
std::string CStringToSTDStr(const CString& theCStr) { // Convert the CString to a regular char array const int theCStrLen = theCStr.GetLength(); char *buffer = (char*)malloc(sizeof(char)*(theCStrLe...
分类:其他好文   时间:2014-06-08 16:33:53    阅读次数:218
LeetCode之Maximum Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest sum....
分类:其他好文   时间:2014-06-08 15:54:08    阅读次数:258
Leetcode: Text Justification. java
Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified. You should pack your words in a greedy approach; that i...
分类:编程语言   时间:2014-06-08 15:25:00    阅读次数:282
LeetCode: Best Time to Buy and Sell Stock [121]
【题目】 Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock), design an algorithm to find the maximum profit. ...
分类:其他好文   时间:2014-06-08 15:11:58    阅读次数:298
检查输入的用户名是否符合规定
代码清单: <?php /** * 检测输入中是否含有错误字符 * @author ruxing.li * @param char $string 要检查的字符串名称 * @return boolean */ function is_badword($string) { $badwords = array("\\",'&',' ',"'",'"','/','*',',',''...
分类:其他好文   时间:2014-06-08 14:49:48    阅读次数:288
[LeetCode] Remove Element [20]
题目 Given an array and a value, remove all instances of that value in place and return the new length. The order of elements can be changed. It doesn't matter what you leave beyond the new length. 原题链接(点我) 解题思路 给一个数组和一个数字,移除该数字在数组中所有出现的地方。 这是一个非常简单的题目,应...
分类:其他好文   时间:2014-06-08 04:05:50    阅读次数:284
[LeetCode] Remove Duplicates from Sorted Array [19]
题目...For example,Given input array A = [1,1,2],Your function should return length = 2, and A is now [1,2]. 解题思路, 移除数组中的重复元素,并返回新数组的长度。 这个题目应该算是简单的题目。使用两个变量就可以。具体的看代码 代码实现......
分类:其他好文   时间:2014-06-08 03:54:22    阅读次数:279
LeetCode——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, whe...
分类:其他好文   时间:2014-06-08 02:12:04    阅读次数:216
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!