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
// https://www.hackerrank.com/challenges/migratory-birds/problem | |
// | |
// Input Output | |
// +-----------------------+----------+ | |
// | 6 | 4 | | |
// | 1 4 4 4 5 3 | | | |
// +-----------------------+----------+ | |
// | 11 | 3 | | |
// | 1 2 3 4 5 4 3 2 1 3 4 | | | |
// +-----------------------+----------+ |
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 scala.io._ | |
trait Date { | |
def toDDMMYYYY: String = ??? | |
} | |
case class ConcreteDate(day: Int, month: String, year: Int) extends Date { | |
override def toDDMMYYYY = s"$day.$month.$year" | |
} | |
case object EmptyDate extends Date |
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
// https://www.hackerrank.com/challenges/the-birthday-bar/problem | |
import scala.io._ | |
import scala.annotation.tailrec | |
object Solution { | |
// Complete the birthday function below. | |
def birthday(s: Array[Int], d: Int, m: Int): Int = { |
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 java.io._ | |
import java.math._ | |
import java.security._ | |
import java.text._ | |
import java.util._ | |
import java.util.concurrent._ | |
import java.util.function._ | |
import java.util.regex._ | |
import java.util.stream._ |
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 java.io._ | |
import java.math._ | |
import java.security._ | |
import java.text._ | |
import java.util._ | |
import java.util.concurrent._ | |
import java.util.function._ | |
import java.util.regex._ | |
import java.util.stream._ |
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 java.io._ | |
import java.math._ | |
import java.security._ | |
import java.text._ | |
import java.util._ | |
import java.util.concurrent._ | |
import java.util.function._ | |
import java.util.regex._ | |
import java.util.stream._ |
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
// If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. | |
// Find the sum of all the multiples of 3 or 5 below 1000. | |
void doShit() { | |
Integer currentValue = 1; | |
Integer acc = 0; | |
while(currentValue < 1000) { | |
boolean imot = ((currentValue / 3) == (currentValue / 3.0)); | |
boolean imof = ((currentValue / 5) == (currentValue / 5.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
((ClassType)((com.sun.tools.javac.code.Symbol)((com.sun.tools.javac.code.Scope.Entry[])((com.sun.tools.javac.code.Scope.ScopeImpl)((com.sun.tools.javac.code.Symbol.PackageSymbol)((JCTree.JCCompilationUnit)cu).packge).members_field).table)[2].sym).type).supertype_field |
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
*.class | |
*.log | |
# sbt specific | |
.cache/ | |
.history/ | |
.lib/ | |
dist/* | |
target/ | |
lib_managed/ |
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
from datetime import datetime | |
from math import ceil | |
import calendar | |
def dates(d1: datetime, d2: datetime) -> list: | |
middle = [] | |
for year in range(d1.year, d2.year): | |
middle.append(datetime(year, 12, 31)) |