Skip to content

Instantly share code, notes, and snippets.

View asela38's full-sized avatar

Asela Illayapparachchi asela38

  • Rakuten
  • Sri Lanka
View GitHub Profile
@ms-tg
ms-tg / jdk8_optional_monad_laws.java
Created November 11, 2013 21:14
Does JDK8's Optional class satisfy the Monad laws? Yes, it does.
/**
* ```
* Does JDK8's Optional class satisfy the Monad laws?
* =================================================
* 1. Left identity: true
* 2. Right identity: true
* 3. Associativity: true
*
* Yes, it does.
* ```
@timotheehub
timotheehub / tw-coding-challenge-question-1-editorial.md
Last active March 19, 2018 07:55
Editorial of the first question of TransferWise Coding Challenge #1

TransferWise Coding Challenge #1

Editorial of the first question: TransferWise Invite Program Winner

The questions are still open and you can try them here.

The question was about finding the person who invited the largest number of users through TransferWise's invite program. This question can be generalized to finding the largest tree in an acyclic unidirectional disconnected graph. If you don't remember it, you can also find it below.

There are multiple ways to solve the first question including:

  1. Finding the root nodes of the trees by finding the nodes without parents