mrlonelyjtr's blog

写BUG的程序猿


  • Home

  • Categories

  • Archives

  • Tags

  • Search

[LeetCode] Problem 208 - Implement Trie (Prefix Tree)

Posted on 2019-08-25 | In Algorithm , LeetCode
Implement a trie with insert, search, and startsWith methods. Example12345678Trie trie = new Trie();trie.insert("apple");trie.search("apple"); // re ...
Read more »

java.util.Observer接口

Posted on 2019-08-25 | In Java
Java类库中的java.util.Observer接口和java.util.Observable类就是一种Observer模式。 java.util.Observer接口中定义了一下方法。 1public void update(Observable obj, Object arg) 而upda ...
Read more »

[LintCode] Problem 817 - Range Sum Query 2D - Mutable

Posted on 2019-08-25 | In Algorithm , LintCode
Given a 2D matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2, col2) ...
Read more »

[LeetCode] Problem 307 - Range Sum Query - Mutable

Posted on 2019-08-25 | In Algorithm , LeetCode
Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. The update(i, val) function modifies nums by upd ...
Read more »

【图解设计模式】Observer模式

Posted on 2019-08-25 | In Design Pattern
当观察对象的状态发生变化时,会通知给观察者。适用于根据对象状态进行相应处理的场景。 示例观察者将观察一个会生成数值的对象,并将它生成的数值结果显示出来。不同的观察者的显示方式不一样。 类图 Observer接口123public interface Observer { public ...
Read more »

【图解设计模式】Mediator模式

Posted on 2019-08-24 | In Design Pattern
组员向仲裁者报告,仲裁者向组员下达指示。组员之间不再相互询问和相互指示。 示例一个GUI应用程序,它展示了一个登录对话框,用户在其中输入正确的用户名和密码后可以登录。 可以选择作为游客访问(Guest)或是作为用户登录(Login) 作为用户登录时,需要输入正确的用户名(Username)和密码( ...
Read more »

[LeetCode] Problem 304 - Range Sum Query 2D - Immutable

Posted on 2019-08-24 | In Algorithm , 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 ...
Read more »

[LeetCode] Problem 303 - Range Sum Query - Immutable

Posted on 2019-08-24 | In Algorithm , LeetCode
Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. ExampleGiven nums = [-2, 0, 3, -5, 2, -1] sumRan ...
Read more »

[LeetCode] Problem 292 - Nim Game

Posted on 2019-08-24 | In Algorithm , LeetCode
You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 ston ...
Read more »

[LeetCode] Problem 283 - Move Zeroes

Posted on 2019-08-24 | In Algorithm , LeetCode
Given an array nums, write a function to move all 0’s to the end of it while maintaining the relative order of the non-zero elements. ExampleInput: [0 ...
Read more »
1…171819…78
mrlonelyjtr

mrlonelyjtr

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

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