mrlonelyjtr's blog

写BUG的程序猿


  • Home

  • Categories

  • Archives

  • Tags

  • Search

【图解设计模式】Composite模式

Posted on 2019-08-08 | In Design Pattern
能够使容器与内容具有一致性,创造出递归结构。 示例列出文件和文件夹的一览。 类图 Entry类12345678910111213141516171819public abstract class Entry { public abstract String getName(); ...
Read more »

[LeetCode] Problem 792 - Number of Matching Subsequences

Posted on 2019-08-07 | In Algorithm , LeetCode
Given string S and a dictionary of words words, find the number of words[i] that is a subsequence of S. ExampleInput:S = “abcde”words = [“a”, “bb”, “a ...
Read more »

[LeetCode] Problem 848 - Shifting Letters

Posted on 2019-08-06 | In Algorithm , LeetCode
We have a string S of lowercase letters, and an integer array shifts. Call the shift of a letter, the next letter in the alphabet, (wrapping around so ...
Read more »

[LintCode] Problem 851 - Pour Water

Posted on 2019-08-06 | In Algorithm , LintCode
Given an elevation map, heights[i] representing the height of the terrain at that index. The width at each index is 1. After V units of water fall at ...
Read more »

[LeetCode] Problem 773 - Sliding Puzzle

Posted on 2019-08-06 | In Algorithm , LeetCode
On a 2x3 board, there are 5 tiles represented by the integers 1 through 5, and an empty square represented by 0. A move consists of choosing 0 and a 4 ...
Read more »

[LeetCode] Problem 332 - Reconstruct Itinerary

Posted on 2019-08-05 | In Algorithm , LeetCode
Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order. All of the tick ...
Read more »

[LeetCode] Problem 875 - Koko Eating Bananas

Posted on 2019-08-05 | In Algorithm , LeetCode
Koko loves to eat bananas. There are N piles of bananas, the i-th pile has piles[i] bananas. The guards have gone and will come back in H hours. Kok ...
Read more »

【图解设计模式】Strategy模式

Posted on 2019-08-04 | In Design Pattern
整体地替换算法的实现部分,能轻松地以不同的算法去解决同一个问题。 示例让电脑玩“猜拳”游戏。第一种策略是“如果这局猜拳获胜,那么下一局也出一样的手势”;另外一种策略是“根据上一局的手势从概率上计算出下一局的手势”。 类图 Hand类1234567891011121314151617181920212 ...
Read more »

【图解设计模式】Bridge模式

Posted on 2019-08-03 | In Design Pattern
在“类的功能层次结构”和“类的实现层次结构”之间搭建桥梁。 父类具有基本功能 在子类中增加新的功能 这种层次结构被称为“类的功能层次结构”。 父类通过声明抽象方法来定义接口(API) 子类通过实现具体方法来实现接口(API) 这种层次结构被称为“类的实现层次结构”。 示例显示一些东西。 类图 ...
Read more »

各种生成实例的方法

Posted on 2019-08-03 | In Java
new使用Java关键字new生成实例。可以像下面这样生成Something类的实例并将其保存在obj变量中。 1Something obj = new Something(); 这时,类名(此处的Something)会出现在代码中。 clone使用clone方法,根据现有的实例复制出一个新的实例 ...
Read more »
1…262728…78
mrlonelyjtr

mrlonelyjtr

间歇性踌躇满志,持续性混吃等死

780 posts
18 categories
18 tags
Github
© 2020 mrlonelyjtr
Powered by Hexo
Theme - NexT.Pisces