`
文章列表
The test cases are divided into 3 classes. The first one is just a pinpoint test class that contains some corner cases: java 代码   package glassball;      import junit.framework.TestCase;   import java.util.List;      /**   * Testcases for path.   */   public cl ...
The next step is to find the actually path of floors that we are going through to find the breaking floor. Here is the code to do that. java 代码   package glassball;      import java.util.List;   import java.util.ArrayList;      /**   * For a given building and balls, fi ...
Here is the code following the logic from the previous post: java 代码   package glassball;      import java.util.List;   import java.util.ArrayList;      /**   * Google interview question   */   public class GlassBallPuzzle   {       // first index is on  ...
Here is the question: 原题: 有一个100层高的大厦,你手中有两个相同的玻璃围棋子。从这个大厦的某一层扔下围棋子就会碎,用你手中的这两个玻璃围棋子,找出一个最优的策略,来得知那个临界层面。 I copied and pasted the above since I can't ...

OOP

    博客分类:
  • OO*
OCP: Open for extension, close for modification(black box) SRP: Single responsibility Principle(do one thing, and do one thing well). DIP: Dependency Inversion Principle(depend on abstraction, not on implementation) ISP: Interface Segregation Principle (narrow interfaces) Law of Demeter: Don’t ta ...
Code references: http://finance-old.bi.no/~bernt/ (C++) http://quantlib.org/ (C++) http://www.mathfinance.org/FF/cpplib.html (Java & JavaScript) http://www.numa.com/ Executables: http://www.snowgold.com/download/downopt.html http://www.mathtools.net/MATLAB/Finance_and_Economics/index.html Tuto ...

Finance books

Unknown: The concepts and practice of mathematical finance Derivatives: Models on Models Brownian Motion and Stochastic Calculus Implementing Derivative Model Modeling: Modeling Derivatives in C++ C++ design patterns and derivatives pricing The complete guide to option pricing formulas Monte carlo ...

OO books

Analysis Patterns Domain Driven Design Tackling Complexity Refactoring

JSE books

Thinking in Java Effective Java Java Puzzlers Traps Pitfalls and Corner Cases Java Pitfalls More Java Pitfalls Hardcore Java Java IO Java NIO Java Network Programming Concurrent Programming in Java Interdisciplinary Computing in Java Programming Language
Effective Enterprise Java Enterprise Integration Patterns Expert One-on-One J2EE Design and Development Professional Java Development with the Spring Framework J2EE Best Practices

Map

...
The discussion started with Martin's post: http://www.martinfowler.com/bliki/AnemicDomainModel.html. The common reasons I've seen why we have anemic model are: Most cases are simple db-to-web, with little domain logic. Books are misleading, people are ignorant. It's hard to find a proper e ...
Constantly, we need to define enums. In Java 1.5, there is also a keyword. However, in JDK 1.4, we are out of the luck and have to come up something to simulate enums. The motivation for enums is to avoid hardcoding same constants everywhere because it makes maintanence a nightmare, hard to track wh ...
The Utils class is composed of some common methods: java 代码   package solve;      import scale.Ball;   import scale.Scale;      import java.util.Iterator;   import java.util.Set;      /**   * utility class, shared common methods.   */   public class  ...
In the 1-ball case, if the status flag is already set, then we don't need to weight anymore. Otherwise, we need to find a good ball to compare. java 代码   package solve;      import scale.Ball;   import scale.Scale;      import java.util.Set;      /**   * 1-ball c ...
Global site tag (gtag.js) - Google Analytics