题目1:Best Time to Buy and Sell Stock
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,...
分类:
其他好文 时间:
2014-05-16 01:46:15
阅读次数:
460
jquery下json数组的操作用法实例:
jquery中操作JSON数组的情况中遍历方法用的比较多,但用添加移除这些好像就不是太多了。
试过json[i].remove(),json.remove(i)之后都不行,看网页的DOM对象中好像JSON数据是以数组的形式出现的,下面是一些实例,仅供参考。...
分类:
Web程序 时间:
2014-05-15 20:52:49
阅读次数:
351
字符串连接误用 错误的写法:String s = ""; for (Person p :
persons) { s += ", " + p.getName(); } s = s.substring(2); //remove first comma
正确的写法:StringBuilde...
分类:
编程语言 时间:
2014-05-15 17:38:49
阅读次数:
493
有各种不同的策略来定位页面中的元素。你可以使用最合适定位方式用于你的用例。Selenium提供了以下方法来定位页面中的元素:find_element_by_idfind_element_by_namefind_element_by_xpathfind_element_by_link_textfi.....
分类:
编程语言 时间:
2014-05-15 17:28:48
阅读次数:
430
【题目】
原文:
1.7 Write an algorithm such that if an element in an MxN matrix is 0, its entire row and column is set to 0.
译文:
写一个函数处理一个MxN的矩阵,如果矩阵中某个元素为0,那么把它所在的行和列都置为0.
【分析】
【思路一】
遍历一次矩阵...
分类:
其他好文 时间:
2014-05-15 12:27:37
阅读次数:
293
http://stackoverflow.com/questions/13011127/how-to-remove-change-jquery-ui-autocomplete-helper-textHow
to remove/change JQuery UI Autocomplete Helper ...
分类:
Web程序 时间:
2014-05-15 09:37:18
阅读次数:
464
Single Number II
Total Accepted: 14472 Total
Submissions: 44420My Submissions
Given an array of integers, every element appears three times except for one. Find that single one.
Note:
Y...
分类:
其他好文 时间:
2014-05-15 01:23:42
阅读次数:
273
【题目】
Implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
The function prototype shoul...
分类:
其他好文 时间:
2014-05-14 21:36:52
阅读次数:
348
题意:从一个已排序的数组中移除掉重复的元素,每个元素最多可重复两次
思路: 思路和Remove Duplicates from Sorted Array一样,不过要设置一个计数变量,表示当前值出现的次数
出现次数少于2可以加入到新数组,多于2则不可以。每次遇到一个新变量要把计数变量重新设置为1,加入新数组要加1
复杂度:时间O(n), 空间O(1)...
分类:
其他好文 时间:
2014-05-14 21:03:00
阅读次数:
262
Total Accepted: 8400 Total Submissions: 38235 My Submissions
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 profi...
分类:
其他好文 时间:
2014-05-14 19:39:53
阅读次数:
275