状态设计模式的关键就是,环境中拥有所需的全部状态对象,每个状态对象又引用了环境对象;环境对象通过维护一个当前状态属性(用于存放状态对象)从而对所需的全部状态对象产生影响。 下面演示了一个简单的状态设计模式,状态设计模式的核心在于47-49行: 运行结果: I am status1 here is s ...
分类:
Web程序 时间:
2018-09-29 00:07:42
阅读次数:
253
2. Add Two numbers Difficulty:Medium The Link https://leetcode.com/problems/add two numbers/ Description Solutions: Solution A: Brute force attack (暴力 ...
分类:
其他好文 时间:
2018-09-28 19:15:52
阅读次数:
197
"原题:372. Super Pow" Your task is to calculate ab mod 1337 where a is a positive integer and b is an extremely large positive integer given in the form ...
分类:
其他好文 时间:
2018-09-28 12:56:56
阅读次数:
154
在抛弃了对.NET 3的支持之后, ASP.NET MVC 4 彻底拥抱了Task类库, 你不需要再蛋疼的给每个Action写两个方法, 也无需傻傻的手动对异步Action计数器增减了(AsyncManager.OutstandingOperations.Increment()), 现在的你只需拿起 ...
分类:
Web程序 时间:
2018-09-27 15:29:53
阅读次数:
164
54. Spiral Matrix [Medium] Description Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order. Exampl ...
分类:
其他好文 时间:
2018-09-24 00:51:47
阅读次数:
132
Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted i ...
分类:
其他好文 时间:
2018-09-23 16:35:55
阅读次数:
140
Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. 1. use an arr ...
分类:
其他好文 时间:
2018-09-23 15:06:24
阅读次数:
122
Given a collection of distinct integers, return all possible permutations. 1. count==n, add tinylist to list; 2. iterate through the input array, if t ...
分类:
其他好文 时间:
2018-09-23 12:00:51
阅读次数:
172
Given a string containing only digits, restore it by returning all possible valid IP address combinations. Example: IP address is consist of 4 parts w ...
分类:
其他好文 时间:
2018-09-23 11:31:47
阅读次数:
148
Given a set of candidate numbers (candidates) (without duplicates) and a target number (target), find all unique combinations in candidates where the ...
分类:
其他好文 时间:
2018-09-23 00:18:57
阅读次数:
145