自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

MissZhou要努力

路漫漫其修远兮,吾将上下而求索

  • 博客(768)
  • 收藏
  • 关注

原创 leetcode 54Spiral Matrix【贪吃蛇】

不懂自己这么水的题居然WA了这么多次而且 为啥要设置flag 反正都是顺时针自己写的class Solution {public: vector<int> spiralOrder(vector<vector<int>>& matrix) { vector<int>ans; if(matr...

2018-10-24 21:49:45 269

原创 leetcode 50. Pow(x, n)【快速幂】

https://leetcode.com/problems/powx-n/description/Implement pow(x, n), which calculates x raised to the power n (xn).Example 1:Input: 2.00000, 10Output: 1024.00000Example 2:Input: 2.10000...

2018-10-24 18:11:34 344

原创 docker-compose demo1【网页计数器】

感觉只有自己写个demo一行行看才明白啊Compose 项目是 Docker 官方的开源项目,负责实现对 Docker 容器集群的快速编排。Compose 项目由 Python 编写,实现上调用了 Docker 服务提供的 API 来对容器进行管理。因此,只要所操作的平台支持 Docker API,就可以在其上利用 Compose 来进行编排管理。 服务 (service):一个应用...

2018-10-23 20:26:18 456

原创 leetcode 49. Group Anagrams【素数相乘处理字符串哈希】

https://leetcode.com/problems/group-anagrams/description/Given an array of strings, group anagrams together.Example:Input: ["eat", "tea", "tan", "ate", "nat", "bat"],Output:[ ["ate

2018-10-23 12:37:25 323 2

原创 leetcode 48. Rotate Image【旋转90】

https://leetcode.com/problems/rotate-image/description/You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Note:You have to rotate the image in-pl...

2018-10-22 10:20:24 151

原创 leetcode 43. Multiply Strings【大数乘法】

https://leetcode.com/problems/multiply-strings/description/Given two non-negative integers num1 and num2 represented as strings, return the product of num1 and num2, also represented as a string.E...

2018-10-18 11:13:28 170

原创 LeetCode40. Combination Sum II

https://leetcode.com/problems/combination-sum-ii/description/Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations in candidates where the c...

2018-10-17 11:18:59 169

原创 leetcode39. Combination Sum【回溯】

https://leetcode.com/problems/combination-sum/description/Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates ...

2018-10-16 17:18:18 215

原创 LeetCode 36. Valid Sudoku【九宫格判断合法】

Determine if a 9x9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules:Each row must contain the digits 1-9 without repetition. Each column must conta...

2018-10-15 12:32:42 425

原创 leetcode33. Search in Rotated Sorted Array【旋转数组找指定值 二分】

Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).You are given a target value to search. If found ...

2018-10-12 18:42:02 151

原创 leetcode 29. Divide Two Integers【二进制】不用除法做整除

Given two integers dividend and divisor, divide two integers without using multiplication, division and mod operator.Return the quotient after dividing dividend by divisor.The integer division sho...

2018-10-10 17:16:30 456

原创 leetcode24. Swap Nodes in Pairs【Python刷题】链表交换相邻位置

Given a linked list, swap every two adjacent nodes and return its head.Example:Given 1->2->3->4, you should return the list as 2->1->4->3.Note:Your algorithm should use only...

2018-10-08 20:32:12 521

原创 leetcode 22. Generate Parentheses

 22. Generate ParenthesesDescriptionHintsSubmissionsDiscussSolutionPick OneGiven n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example,...

2018-09-28 17:57:17 123

原创 leetcode 19. Remove Nth Node From End of List【Python刷题】

Given a linked list, remove the n-th node from the end of list and return its head.Example:Given linked list: 1->2->3->4->5, and n = 2.After removing the second node from the end, t...

2018-09-27 16:53:00 167

原创 设计模式——职责链模式

使多个对象都有机会处理请求,从而避免请求的发送者和接收者之间的耦合关系。将这个对象连成一条链,并沿着这条链传递请求,直到有一个对象处理他为止。namespace 职责链模式{ abstract class Handler { protected Handler successor; public void SetSuccessor(Handl...

2018-09-26 18:41:52 134

原创 leetcode 18. 4Sum

Given an array nums of n integers and an integer target, are there elements a, b, c, and d in nums such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of tar...

2018-09-20 18:28:53 134

原创 设计模型——解释器模式interpret

解释器模式:给定一个语言,定义它的文法的一种表示,并定义一个解释器,这个解释器使用该表示来解释语言中的句子需要解决的问题是:如果一种特定雷丁的问题发生的频率足够高,那么可能就值得将该问题的各个实例表述为一个简单语言中的句子。这样就可以构造一个解释器,该解释器通过解释这些句子来解决该问题。通常当有一个语言需要解释执行,并且你可将该语言中的句子表示为一个抽象语法树时,可以使用用了解释器...

2018-09-13 10:36:09 232

原创 leetcode17Letter Combinations of a Phone Number【队列】

Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephone buttons) is giv...

2018-09-12 17:36:15 323

原创 最长公共子串&最长公共子序列

子串要求连续子序列不要求连续之前的做法是dp求子序列 #include <iostream>#include <cstdio>#include <cstring>using namespace std;const int INF = 0x3f3f3f3f;const int MOD = 1000000007;string s1,s2...

2018-09-06 10:32:56 225

原创 leetcode 16 3Sum Closest【双指针 变形】

Given an array nums of n integers and an integer target, find three integers in nums such that the sum is closest to target. Return the sum of the three integers. You may assume that each input would ...

2018-09-05 20:51:25 154

原创 牛客网oi测试赛E旅行青蛙【LIS二分】

链接:https://www.nowcoder.com/acm/contest/181/E来源:牛客网 题目描述一只青蛙出去旅游,因为中国有一句古话说的好:“由简入奢易,由奢入俭难”,所以这只青蛙当看的当前景点比前面看过的景点差的时候,青蛙就会说“不开心”为了避免这只青蛙说“不开心”,并且使青蛙看的景点尽量的多,所以他请你帮忙给他安排一条线路,使青蛙可以看到尽量多的景点,并且不走回头路...

2018-09-05 17:51:11 396

原创 leetcode 15 3-sum【双指针】

Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.Note:The solution set must not cont...

2018-08-01 10:31:32 302

原创 leetcode 12. Integer to Roman【Python】模拟

Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X 10L 50C 100D ...

2018-07-30 09:30:53 257

原创 leetcode 8. String to Integer (atoi)【Python 正则表达式】

规则好多哦……Implement atoi which converts a string to an integer.The function first discards as many whitespace characters as necessary until the first non-whitespace character is found. Then, starting...

2018-07-30 08:20:17 299

原创 P2865 [USACO06NOV]路障Roadblocks【次短路】

370通过1K提交题目提供者FarmerJohn2评测方式云端评测标签USACO2006难度提高+/省选-时空限制1000ms / 128MB【P2865】[USACO06NOV]路障Roadblocks - 洛谷 https://www.luogu.org/problemnew/show/P2865题目描述Bessie has moved to a small farm and sometime...

2018-07-11 19:42:25 393 3

原创 leetcode 5 Longest Palindromic Substring【manacher算法】

Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example 1:Input: "babad"Output: "bab"Note: "aba" is also a valid answer.Example 2:...

2018-07-06 10:33:24 215

原创 leetcode3 Longest Substring Without Repeating Characters【Python刷题】【哈希】

Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answer is "b", with the l...

2018-06-29 10:02:21 186

原创 leetcode1 Two sum【基础题】【Python刷题】

Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, and you may not use the same el...

2018-06-28 09:02:15 637

原创 leetcode11 Container With Most Water【挡板存水,双指针】【Python刷题】

因为是搜单调队列搜到这个题这个就是误导我的博客http://www.cnblogs.com/Phantom01/p/5871977.html想着单调队列想了两天,又综合了单调栈优化dp:hdu1506Largest Rectangle in a Histogram &hdu1505city game dp想了一下是否是单调栈优化,发现了单调队列和单调栈对数组末尾的处理是一样的,区别只是在于...

2018-06-27 11:50:16 468

原创 leetcode 714. Best Time to Buy and Sell Stock with Transaction Fee【贪心??水题】

Your are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative integer fee representing a transaction fee.You may complete as many tr...

2018-06-13 10:08:10 328

原创 android studio Unable to resolve dependency for ':app@

网上主要是说 1.修改build.gradle 文件 buildscript { repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3....

2018-05-19 11:10:15 897

原创 设计模式——命令模式Command

将一个命令封装为一个对象,从而使你可用不同的请求对客户进行参数化;对请求排队或记录请求日志,以及支持可撤销的操作优点:1.比较容易设计出一个命令队列2.在需要的情况下,可以比较容易地将命令记入日志3.允许接收请求的一放决定是否要否决请求4.容易实现对于请求的撤销与重做5.由于加入新的具体命令类不影响其他的类,因此增加新的具体命令类很容易6.把请求一个操作的对象与知道怎么执行一个操作的对象分割开us...

2018-04-25 14:24:36 174

原创 设计模式——备忘录模式Memento

算的上是比较简单的设计模式了,然而自己写还是磕磕绊绊定义:在不破坏封装性的前提下,捕获一个对象的内部状态,并在该对象之外保存这个状态。这样以后就可以将该对象恢复到原先保存的状态。Originator(发起人)负责创建一个备忘录,用以记录时刻它的内部状态,并可使用备忘录回复内部状态。Originator可根据需要决定备忘录存储那些内部状态Memento(备忘录)负责存储发起人对象的内部状态,并可防止...

2018-04-24 18:14:58 252

原创 设计模式——状态模式State

针对方法过长违背“单一职责原则”和“开放封闭原则”而提出    定义:当一个对象的内在状态改变时允许改变其行为,这个对象看起来是改变其类主要解决的是当控制一个对象状态转换的条件表达式过于复杂的情况。把状态的判断逻辑转移到表示不同状态的一系列类当中,可以把复杂的判断逻辑简化好处:将于特定状态相关的行为局部化,并且将不同状态的行为分割开来,将特定的状态相关的行为都放入一个对象中,由于所有状态相关的代码...

2018-04-23 16:07:11 179

原创 设计模式——桥接模式bridge

将抽象部分和实现分离,使得他们可以独立变化using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace 桥接模式{ abstract class HandsetSoft { ...

2018-04-19 13:54:47 175

原创 leetcode 91. Decode Ways

简单dp感觉自己越来越差了==可能本来就是这个水平吧orz能想到dp[i]=dp[i-1]+dp[i-2]但是写不明白,20+行的代码还要找标称其实如果想着判断两位字符是用函数封装一下,问题就是so easy单独一位的不合法的情况只有为'0'两位的是大于>27如果遍历到某一位发现dp==0 直接return 0还是要好好练习呀class Solution {public: bool...

2018-04-10 18:06:36 174

原创 设计模式——装饰模式Decorate

装饰模式定义:动态给一个对象添加一些额外的职责,就增加功能来说,装饰模式比生成子类更为灵活Component是定义了一个对象接口,可以给这些对象动态添加职责。ConcreteComponent是定义了一个具体的对象,也可以给这个对象添加一些职责Decorator装饰抽象类,继承了Component从外类来扩展Component类的功能,但对于Component来说,是无需知道Decorater的存...

2018-04-09 11:16:30 487

原创 leecode 135. Candy【贪心】

https://leetcode.com/problems/candy/description/There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requi...

2018-04-08 11:55:31 170

原创 设计模式——享元模式Flyweight

定义:运用共享技术有效支持大量细粒度的对象有一个享元工厂,用来创建并管理flyweight对象。它主要是确保合理共享flyweight,当用户请求一个flyweight时,flyweight工厂对象提供一个已知创建的实例或者创建一个内部状态和外部状态:在享元对象内部并且不会随环境变化而变化的共享状态,是享元对象的内部状态随环境改变而改变的,不可以共享的状态是外部状态使用情景:如果一个应用程序使用了...

2018-04-06 15:43:40 201

原创 设计模式——组合模式Composite

逻辑非常清晰,代码非常好写的一种设计模式定义:讲对象组合成树形结构以表示“部分-整体”的层次结构。组合你是是的用户对单个对象和组合对象的使用具有一致性using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespac...

2018-03-28 14:50:00 262

空空如也

空空如也

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

TA关注的人

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