Skip to content

Instantly share code, notes, and snippets.

View kwangshin's full-sized avatar

Kwangshin kwangshin

View GitHub Profile
@kwangshin
kwangshin / TwoRectanglesArea.java
Created September 17, 2015 14:41
Get the sum of area of two rectangles.
/**
* Created by Kwangshin on 2015-09-17.
* Email : kwangshin@gmail.com
*/
public class TwoRectanglesArea {
public int getAreaOfTwoRectangles(int K, int L, int M, int N, int P, int Q, int R, int S) {
// Get the sum of area of two rectangles separately, i.e., no concern about the overlapped area.
long twoRectanglesAreaSeparately = this.getTwoRectanglesAreaSeparately(K, L, M, N, P, Q, R, S);
// Overlapping area right is the smaller value in two rectangles right values.