- 博客(12)
- 收藏
- 关注
原创 【LeetCode 84. Largest Rectangle in Histogram】
Given n non-negative integers representing the histogram's bar height where the width of each bar is 1, find the area of largest rectangle in the histogram.Above is a histogram where width of each ...
2018-09-10 12:56:49 137
原创 【LeetCode 128 Longest Consecutive Sequence】
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.Your algorithm should run in O(n) complexity.Example:Input: [100, 4, 200, 1, 3, 2]Output: 4Ex...
2018-08-27 16:30:25 136
原创 【LeetCode 115 Distinct Subsequences】
Given a string S and a string T, count the number of distinct subsequences of S which equals T.A subsequence of a string is a new string which is formed from the original string by deleting some (ca...
2018-08-26 23:02:32 204
原创 【LeetCode 78 Subsets】
Given a set of distinct integers, nums, return all possible subsets (the power set).Note: The solution set must not contain duplicate subsets.Example:Input: nums = [1,2,3]Output:[ [3], [1...
2018-08-24 16:37:26 92
原创 【LeetCode 11 Container With Most Water】
Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i is at (i, ai) and (i, 0). Find two...
2018-08-23 16:53:30 129
原创 【LeetCode 665 Non-decreasing Array】
Given an array with n integers, your task is to check if it could become non-decreasing by modifying at most 1 element.We define an array is non-decreasing if array[i] <= array[i + 1] holds for e...
2018-08-22 11:03:46 120
原创 【LeetCode 41 First Missing Positive】
Given an unsorted integer array, find the smallest missing positive integer.Example 1:Input: [1,2,0]Output: 3Example 2:Input: [3,4,-1,1]Output: 2Example 3:Input: [7,8,9,11,12]Outpu...
2018-08-22 10:02:41 112
原创 【LeetCode 45 Jump Game II】
Description:Given an array of non-negative integers, you are initially positioned at the first index of the array.Each element in the array represents your maximum jump length at that position.Y...
2018-08-08 12:37:33 152
原创 【Binary Search】二分查找(普通二分查找;重复元素返回第一个索引的二分查找;查找范围为2次幂的二分查找)
/* common binarySearch */int commonbinarySearch(int arr[], int len, int key){ int index = -1; int low=0, high=len-1, mid; while(low <= high){ mid = (low + high) / 2; i...
2018-08-07 00:40:11 939
原创 【Calendar Function】计算日期差
问题:求解year1-month1-day1 和 year2-month2-day2的日期差 思路:将两个date间的间隔天数计算转换为计算两个日期到同一基准日期的天数差 说明(如图所示): 求解dist1, _dist2(year-month-day是year那一年的第多少天) 求解sum(year1一整年的天数 + 中间所有年的天数(365or366)...
2018-08-06 19:46:59 1153
原创 配置Hadoop 伪分布式 _NameNode格式化问题_解决方案
【Ubuntu 16.04 Hadoop2.9.1】跟着厦大林子雨的实验指南配置伪分布式环境时出现了以下问题:在修改了/etc/hadoop/core-site.xml & /etc/hadoop/hdfs-site.xml后namenode -format时出现 Cannot create directory /Softwares/hadoop/tmp/dfs/name/curren...
2018-05-31 21:24:22 3412
原创 括号匹配
#include#include#define MAXSIZE 100using namespace std;stack s;int main(){ char str[MAXSIZE]; while(cin>>str){ int i; char ch; for(i=0;str[i]!=0;i++){ if(str[i]=='('||str[i]=='['||str[
2016-07-09 18:32:50 301
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人