自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(23)
  • 资源 (1)
  • 收藏
  • 关注

原创 Longest Substring Without Repeating Characters --- LeetCode

Problem:Given a string, find the length of the longest substring without repeating characters.Example 1:Input: "abcabcbb"Output: 3 Explanation: The answer is "abc", which the length is 3.E...

2018-08-25 23:40:03 171

原创 Add Two Numbers --- LeetCode

Problem:You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers an...

2018-08-25 23:37:47 219

转载 面向对象的方法

面向对象思想----不看后悔!转载自:https://zhidao.baidu.com/question/16967584.html回答前言:整理这份资料的目的是为了帮助朋友们能够更直观的理解面向对象的编程。让后来者能够少走一些弯路。但其中不免有许多漏洞及错误,也还请前辈提出宝贵的更改意见,毕竟交流会让我们不断的进步。技术是日新月异的,他不会等待你的成长。技术要拿出来于别人交流,自

2017-06-17 12:14:49 418

原创 括号匹配 (简易版) 栈

假设一个算数表达式之中允许包含三种括号:圆括号,方括号,大括号。设计一个算法采用顺序栈判断表达式值中的括号是否正确配对。详情见代码:#include #include using namespace std;stack op;int Match(char exp[], int n){ int i = 0, tag = 1; while (i < n&&tag == 1

2017-05-29 17:27:08 812

转载 中缀转后缀 栈

算术表达式中的简单算术表达式,由中缀转为后缀的方法:将中缀表达式exp转化为后缀表达式postexp的过程如下while(从exp中读取字符ch,ch!=‘\0'){若ch是数字,将后继的数字均依次存放到postexp之中,并以字符“#”标志数值串结束;若ch为左括号,将此括号进栈到op之中;若ch为右括号,将op栈中的左括号之前的运算符全部依次退栈并放入postexp之中,将

2017-05-29 16:58:52 644

转载 顺序表求差集

#include using namespace std;typedef struct{int data[100];int length;}SqList;void diffence(SqList A, SqList B,SqList &C){int i = 0, j = 0, k = 0;while (i {if (A.data[i]

2017-05-29 16:29:42 1381

转载 在不改变顺序表元素之间的顺序的情况下,删除其中相同的元素。

在不改变顺序表元素之间的顺序的情况下,删除其中相同的元素。要求空间复杂度为O(1)。详情见代码:#include using namespace std;typedef struct{ int data[100]; int length;}SqList;void delsame(SqList &l){ int i, k; int j = 0; for (i = 1; i

2017-05-29 16:20:11 604

转载 有序表归并算法

每当一个有序表(从小到大)采用顺序表结构存储时,称为有序顺序表。假设每个顺序表中元素均不相同,将两个具有相同次序的有序顺序表归并为一个有序顺序表时的过程就称为有序顺序表的归并。算法如下所示:#include using namespace std;typedef struct{ int data[100]; int length;}SqList;void Merge(SqList

2017-05-29 16:07:44 3970 1

原创 Range Sum Query 2D - Immutable LeetCode

题目:Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2, col2).The above rectangle (with t

2017-05-22 19:01:46 252

原创 198. House Robber LeetCode

题目描述:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjac

2017-05-07 19:21:46 257

原创 134. Gas Station LeeCode

There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs cost[i] of gas to travel from station i to

2017-04-25 13:22:28 341

原创 392. Is Subsequence LeetCode

Given a string s and a string t, check if s is subsequence of t.You may assume that there is only lower case English letters in both s and t. t is potentially a very long (length ~= 500,000) strin

2017-04-23 19:52:50 322

原创 209. Minimum Size Subarray Sum LeetCode

Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If there isn't one, return 0 instead.For example, given the

2017-04-12 22:07:32 254

原创 496. Next Greater Element I LeetCode

You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1's elements in the corresponding places of nums

2017-04-10 13:45:37 347

原创 541. Reverse String II LeetCode

题目:Given a string and an integer k, you need to reverse the first k characters for every 2k characters counting from the start of the string. If there are less than k characters left, reverse all

2017-03-26 19:30:48 273

原创 53. Maximum Subarray LeetCode

Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,1,-5,4],the contiguous subarray [4,-1,2,1] ha

2017-03-07 20:37:47 303

原创 169. Majority Element LeetCode

Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element

2017-03-07 19:53:05 305

原创 LeetCode 241. Different Ways to Add Parentheses

Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are +, - and *.Example 1

2017-03-05 19:48:32 290

原创 LeetCode 503. Next Greater Element II

503. Next Greater Element IIGiven a circular array (the next element of the last element is the first element of the array), print the Next Greater Number for every element. The Next Greater Num

2017-02-25 16:27:33 357

原创 LeetCode 485. Max Consecutive Ones

Given a binary array, find the maximum number of consecutive 1s in this array.Example 1:Input: [1,1,0,1,1,1]Output: 3Explanation: The first two digits or the last three digits are consecutiv

2017-02-25 15:34:56 392

原创 金字塔数组

#include #include #include using namespace std;int main(){ int m,k; int n=0; int h=0; cin>>m; k=m; for(;n<k;n++) { int x=0; m--; int i=m-1; int t=h; for(;i>-1;i--)

2017-02-24 22:28:39 771

原创 用C++实现简单地多项式运算。(因为是菜鸟,会有一些漏洞)

#include #include using namespace std;class Data{ public: double coef;//系数 int exp;//指数 };class Poly{public: Data poly[40];//用数组表达多项式 ,设定多项式最高40次,可以更改 Poly()//初始化 { for(int i=0

2017-02-22 20:48:31 2582

原创 简单的螺旋矩阵的实现

简单地用c++实现螺旋矩阵

2017-02-22 20:46:32 2182

多项式计算用c++实现

个人是菜鸟,不喜勿喷

2017-02-22

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除