首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
  • 您找到你想要的搜索结果了吗?
    是的
    没有找到

    模式-“里氏替换原则”

    里氏替换原则是,同组的有类的两个子类,在使用子类A这个地方(方法/属性)您可以使用子类 B代替.对于面向接口编程,我只需要确保同样的行为代码;基类的所有子类必须全部 实现,换过来,子类的方法基类不一定都有; 如果:有一个基类Base;其子类是Concrete;那么method(Base b)的调用能够转换成 method(Concrete c); 策略模式:一般,我们把解决某个问题的方法称为一个”算法”,而把解决一类问题的算法封装 成一个接口,那么实现算法的多种方式作为子类;在某个时候,在调用中我们使用算法A替换 算法B,这就是策略模式在里氏代换原则中的应用; ***************策略模式************************************ >准备一组算法,并将每个封装起来使的他们能够互换.

    02

    2018-12-15 LintCode LeeCode刷题指南 part2

    |270|Missing Number.java|Easy|Java|[Array, Bit Manipulation, Math]|| |271|LRU Cache.java|Hard|Java|[Design, Hash Table, Linked List]|| |272|Remove Duplicates from Sorted Array.java|Easy|Java|[Array, Two Pointers]|| |273|Remove Duplicates from Sorted Array II.java|Medium|Java|[Array, Two Pointers]|| |274|Remove Duplicates from Sorted List.java|Easy|Java|[Linked List]|| |275|Remove Duplicates from Sorted List II.java|Medium|Java|[Linked List]|| |276|QuickSort.java|Medium|Java|[Quick Sort, Sort]|| |277|MergeSort.java|Medium|Java|[Merge Sort, Sort]|| |278|Longest Word in Dictionary.java|Easy|Java|[Hash Table, Trie]|| |279|Binary Tree Level Order Traversal.java|Medium|Java|[BFS, DFS, Tree]|| |280|Binary Tree Level Order Traversal II.java|Medium|Java|[BFS, Tree]|| |281|Binary Tree Longest Consecutive Sequence II.java|Medium|Java|[DFS, Divide and Conquer, Double Recursive, Tree]|| |282|Binary Tree Maximum Path Sum.java|Hard|Java|[DFS, DP, Tree, Tree DP]|| |283|Path Sum.java|Easy|Java|[DFS, Tree]|| |284|Path Sum II.java|Easy|Java|[Backtracking, DFS, Tree]|| |285|Path Sum III.java|Easy|Java|[DFS, Double Recursive, Tree]|| |286|Rotate String.java|Easy|Java|[String]|| |287|Combinations.java|Medium|Java|[Backtracking, Combination, DFS]|| |288|Combination Sum IV.java|Medium|Java|[Array, Backpack DP, DP]|| |289|Binary Tree Right Side View.java|Medium|Java|[BFS, DFS, Tree]|| |290|Binary Tree Maximum Path Sum II.java|Medium|Java|[DFS, Tree]|| |291|Rotate List.java|Medium|Java|[Linked List, Two Pointers]|| |292|Basic Calculator.java|Hard|Java|[Binary Tree, Expression Tree, Math, Minimum Binary Tree, Stack]|| |293|Longest Consecutive Sequence.java|Hard|Java|[Array, Hash Table, Union Find]|| |294|Binary Tree Longest Consecutive Sequence.java|Medium|Java|[DFS, Divide and Conquer, Tree]|| |295|Number of Connected Components in an Undirected Graph.java|Medium|Java|[BFS, DFS, Graph, Union Find]|| |296|Next Closest Time.java|Medium|Java|[Basic Implementation, Enumeration, String]|| |297|Serialize and Deseriali

    02
    领券