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 exa...
分类:
其他好文 时间:
2014-10-12 18:17:08
阅读次数:
242
Given a list, rotate the list to the right by k places, where k is non-negative.
For example:
Given 1->2->3->4->5->NULL and k = 2,
return 4->5->1->2->3->NULL.
Solution:
/**
* Definition for ...
分类:
其他好文 时间:
2014-10-12 13:33:18
阅读次数:
161
code:class Solution {public: int maxSubArray(int A[], int n) { int f=0, result=INT_MIN; for(int i=0; i<n; i++){ f=max(f+A[...
分类:
其他好文 时间:
2014-10-12 11:28:07
阅读次数:
143
sudo apt-get update --更新软件源sudo apt-get upgrade -更新已经安装的软件以非root用户更新系统sudo: sudo是linux系统管理指令,是允许系统管理员让普通用户执行一些或者全部的root命令的一个工具,如halt,reboot,su等等。这样不.....
分类:
其他好文 时间:
2014-10-12 10:25:07
阅读次数:
200
Brute force solution:Iterate 32 times, each time determining if the ith bit is a ’1′ or not. This is probably the easiest solution, and the interviewe...
分类:
其他好文 时间:
2014-10-12 06:43:57
阅读次数:
219
原题地址:https://oj.leetcode.com/problems/maximum-product-subarray/解题思路:主要需要考虑负负得正这种情况,比如之前的最小值是一个负数,再乘以一个负数就有可能成为一个很大的正数。代码:class Solution: # @param A...
分类:
编程语言 时间:
2014-10-11 20:28:16
阅读次数:
238
Given a 2D binary matrix filled with 0's and 1's, find the largest rectangle containing all ones and return its area.
class Solution {
public:
int largestRectangleArea(int* height, int length) {
...
分类:
其他好文 时间:
2014-10-11 17:37:26
阅读次数:
156
使用pyqt完成窗体界面很方便,但是打包成exe之后会有问题,在网上找到解决办法如下:Another Solution to the same problem:1 from distutils.core import setup2 import py2exe3 setup(windows=[{"sc...
分类:
其他好文 时间:
2014-10-11 15:50:45
阅读次数:
159
Intuitively there must a O(n) solution.First I tried a bottom-up DP solution but it had a TLE:class Solution {public: int maxProduct(int A[], int n...
分类:
其他好文 时间:
2014-10-11 08:50:25
阅读次数:
141
BFS:Is it possible that a solution exists using only one single queue? Yes, you bet. The single queue solution requires two extra counting variables w...
分类:
其他好文 时间:
2014-10-11 03:37:04
阅读次数:
190