/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
bool hasCycl...
分类:
其他好文 时间:
2014-10-04 15:09:06
阅读次数:
187
Minimum Depth of Binary Tree
Total Accepted: 24760 Total
Submissions: 83665My Submissions
Given a binary tree, find its minimum depth.
The minimum depth is the number of nodes along the ...
分类:
其他好文 时间:
2014-10-04 12:50:06
阅读次数:
146
(1)修改了/etc/sudoer之后报错,sudoworldwritableSolution:pkexecchmod0440/etc/sudoers(2)添加其他用户的sudo权限Solution:1、用root帐号登录或者su到root。2、增加sudoers文件的写权限:chmodu+w/etc/sudoers3、vim/etc/sudoers找到rootALL=(ALL)ALL在这行下边添加dituhuiAL..
分类:
系统相关 时间:
2014-10-04 04:24:56
阅读次数:
285
Given a set of distinct integers, S, return all possible subsets.
Note:
Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets.
For example,
I...
分类:
其他好文 时间:
2014-10-03 22:24:55
阅读次数:
273
N(n*m)的时间复杂度public class Solution {public String strStr(String haystack, String needle) { int nLen = needle.length(); int hLen = haystack.lengt...
分类:
其他好文 时间:
2014-10-03 18:20:54
阅读次数:
157
初看貌似有点复杂,但是搞懂了非常简单,就一个简单的栈应用,每次遇到计算符号"+", "-", "*", "/"就将栈顶端两个数字出栈,计算后再将结果压栈即可。。
#include
#include
#include
using namespace std;
class Solution {
public:
int evalRPN(vector &tokens) {
stack s...
分类:
其他好文 时间:
2014-10-03 15:36:44
阅读次数:
144
In this Document
Symptoms
Cause
Solution
Still Have Questions?
References
APPLIES TO:
Oracle Trading Communi...
分类:
其他好文 时间:
2014-10-02 19:53:03
阅读次数:
387
Follow up for problem "Populating Next Right Pointers in Each Node".
What if the given tree could be any binary tree? Would your previous solution still work?
Note:
You may only use constant ...
分类:
其他好文 时间:
2014-10-02 14:18:33
阅读次数:
267
最近一直忙着写paper,很久没做题,一下子把题目搞复杂了。。思路理清楚了非常简单,每次只需更新2个值:最大乘积和最小乘积。最大乘积被更新有三种可能:当前A[i]>0,乘以前面最大的数(>0),得到新的最大乘积;当前A[i]0,(A[i-1]==0。最小乘积同理。。
class Solution {
public:
int Max(int a, int b, int c)
{...
分类:
其他好文 时间:
2014-10-02 02:54:12
阅读次数:
170
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity1. Naive Solution思路:直接的想法依次找出列表中的最小项串接起来。 复杂度分析:时间复杂度...
分类:
其他好文 时间:
2014-10-02 01:18:11
阅读次数:
163