Skip to content

Instantly share code, notes, and snippets.

/**
* Created by uenyioha on 5/16/2016.
*/
import scalaz.FingerTree._
import scalaz._
import scalaz.syntax.Ops
sealed abstract class PriorityQueue[A]() extends Ops[FingerTree[Int, A]] {
@rasjones
rasjones / solutions.scala
Last active May 20, 2016 23:21
Solutions for HackerRank Interview
// derived this formula for summation of odd integers
def calculate(arr: Array[Int]) = {
arr.map{
(days) =>
val numOddPairs = Math.round((days - 1).toDouble / 4)
val numOddNumbers = Math.ceil(days.toDouble / 2).toInt
val midPoint = days match {
case _ => if (numOddNumbers % 2 == 1) Math.ceil(days.toDouble / 2).toInt else 0
}
@rasjones
rasjones / gist:f347f148b9a8787049a6
Created May 31, 2015 09:54
Swagger Akka HTTP MicroServices Example
import akka.actor.ActorSystem
import akka.event.{Logging, LoggingAdapter}
import akka.http.scaladsl.Http
import akka.http.scaladsl.client.RequestBuilding
import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport._
import akka.http.scaladsl.marshalling._
import akka.http.scaladsl.model._
import akka.http.scaladsl.model.StatusCodes._
import akka.http.scaladsl.server.Directives
import akka.http.scaladsl.server.Directives._