相当于VC6里的.dsw和.dsp.Net解决方案下 .sln文件和.suo文件的解释:When a Web site is created, a solution file (.sln) and a hidden solution user options file (.suo) are crea...
分类:
其他好文 时间:
2014-08-19 09:21:33
阅读次数:
170
过程:从右往左,找到第一个A[i] A[i], j > i;交换A[i] 与 A[j];将A[j+1]之后的元素逆序。代码: 1 class Solution { 2 public: 3 void nextPermutation(vector &num) { 4 if(nu...
分类:
其他好文 时间:
2014-08-19 00:48:53
阅读次数:
248
题目:
链接
解答:
自底向上求解。left_max right_max分别返回了左右子树的最大路径和,如果左右子树最大路径和小于0,那么返回零, 用这个最大路径和和根节点的值相加,来更新最大值,同时, 更新返回该树的最大路径值。
代码:
class Solution {
public:
int max = INT_MIN;
int maxPathSum(TreeNode *...
分类:
其他好文 时间:
2014-08-18 23:39:53
阅读次数:
397
问题:给定一个输入字符串,字符串字反向词。例如s = "the sky is blue",返回 "blue is sky the".我的答案:class Solution {public: void reverseWords(string &s) { if(s.size() r...
分类:
编程语言 时间:
2014-08-18 23:22:23
阅读次数:
450
package com.lw.leet4;/** * @ClassName:Solution * @Description: * Sort List * Sort a linked list in O(n log n) time using constant spa...
分类:
其他好文 时间:
2014-08-18 20:26:22
阅读次数:
170
在 Windows Mobile Device Center 处点击 Mobile Device Settings, Connection Settings, 选择 This computer connects to => The Internet 按 [OK] 退出在 WM 设备上,设置 => 连...
题意: 判断给出的线段是否组成了多边形。Solution: 简单题,并查集+hash 这里用map实现code#include #include #include #include using namespace std;typedef pair ii;map f;int f...
分类:
其他好文 时间:
2014-08-18 17:45:12
阅读次数:
277
Simply a variation of 3Sum:class Solution {public: int threeSumClosest(vector &num, int target) { int ret = 99999999999; std::sort(nu...
分类:
其他好文 时间:
2014-08-18 12:12:34
阅读次数:
193
Follow up for N-Queens problem.
Now, instead outputting board configurations, return the total number of distinct solutions.
public class Solution {
public int totalNQueens(int n) {
...
分类:
其他好文 时间:
2014-08-18 10:49:54
阅读次数:
206
Problem:
Give a series of IP segments, for example, [0.0.0.1-0.0.0.3], [123.234.232.21-123.245.21.1]...
Now there is a new IP, find which IP segment it's in ?
Solution:
First, we could map the end...
分类:
其他好文 时间:
2014-08-18 00:18:13
阅读次数:
309