This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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._ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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]] { |