题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4956(它放在题库后面的格式有一点点问题啦,所以就把它粘下来,方便读者观看) 题目意思:给出一个范围 [l, r] 你, 问是否能从中找到一个数证明Hanamichi’s solution 的解法是错.....
分类:
其他好文 时间:
2014-08-17 22:40:52
阅读次数:
217
class Solution {public: string convert(string s, int nRows) { int len = s.length(); if (len cols; int si = 0; int ri =...
分类:
其他好文 时间:
2014-08-17 21:21:32
阅读次数:
218
Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is ...
分类:
其他好文 时间:
2014-08-17 21:08:02
阅读次数:
339
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.思路:取数组的中点为树的根,前半部分为左子树,后半部分为右子树。 1 class Solution { 2...
分类:
其他好文 时间:
2014-08-17 13:02:12
阅读次数:
210
https://oj.leetcode.com/problems/minimum-window-substring/模拟题这道题细节比较多。从左到右扫一遍模拟着做 class Solution {public: string minWindow(string S, string T) { ...
K-NiceTime Limit:1 Second Memory Limit:32768 KB Special JudgeThis is a super simple problem. The description is simple, the solution is simple. If you...
分类:
其他好文 时间:
2014-08-17 02:16:11
阅读次数:
273
O(n^2) is a naive solution. As rule of thumb, there must be O(n) soluion. Yes - greedy (WHY?)class Solution {public: int maxArea(vector &height) ...
分类:
其他好文 时间:
2014-08-16 15:04:30
阅读次数:
153
今天在ubuntu下安装任何软件都提示以下错误:You might want to run 'apt-get -f install' to correct these:The following packages have unmet dependencies:kate : Depends: kde...
分类:
其他好文 时间:
2014-08-16 13:49:20
阅读次数:
454
1 package com.lw.leet2; 2 3 /** 4 * @ClassName:Solution 5 * @Description: 6 * Evaluate the value of an arithmetic expression in Reverse P...
分类:
其他好文 时间:
2014-08-16 13:44:40
阅读次数:
211
Simply DFS + Backtrace, as N-Queenclass Solution {public: vector> rows; vector> cols; vector>> subboxHm; bool isValid(char c, int i, int j...
分类:
其他好文 时间:
2014-08-16 07:29:10
阅读次数:
166