Skip to content

Instantly share code, notes, and snippets.

View dmgcodevil's full-sized avatar
👽
coding

Roman Pleshkov dmgcodevil

👽
coding
  • Lost in the static
  • USA, NY
View GitHub Profile
public class MinimumWindowSubstring {
public static void main(String[] args) {
assertEquals("ba", minWindow("bba", "ab"));
assertEquals("b", minWindow("ab", "b"));
assertEquals("", minWindow("ab", ""));
assertEquals("bc", minWindow("abc", "bc"));
assertEquals("ab", minWindow("abc", "ab"));
assertEquals("b", minWindow("abc", "b"));
@dmgcodevil
dmgcodevil / Existential.scala
Created February 28, 2017 05:05
Example of Existential Type in Scala
/**
* Created by dmgcodevil on 2/27/2017.
*/
object Existential {
// M[T] forSome { type T; } is the type of all things for which there is some T such that they are of type M[T]
// it's possible to use type bounds: T <: Number
type AllArrays = Array[T] forSome {type T} // -> Array[_] ; the type of all arrays
type AnyArray = Array[T forSome {type T}] // -> Array[Any]
@dmgcodevil
dmgcodevil / Phantom.scala
Created February 28, 2017 05:03
Example of Phantom type in Scala
/**
* Created by dmgcodevil on 2/27/2017.
*/
object Phantom {
object Hacker {
sealed trait State
object State {
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;
public class SegmentAndPoint {
public static final OrderY ORDER_Y = new OrderY();
public static final OrderX ORDER_X = new OrderX();
package seg;
import java.util.Comparator;
import java.util.Scanner;
import java.util.TreeSet;
public class SegmentAndPoint {
private static int[] fastCountSegments(int[] starts, int[] ends, int[] points) {
@dmgcodevil
dmgcodevil / affirmation
Created April 14, 2015 13:25
MuleSoft Contributor Agreement Acceptance by Roman_Pleshkov
I, Roman_Pleshkov, have read and do accept the MuleSoft Contributor Agreement
at http://www.mulesoft.org/legal/contributor-agreement.html
Accepted on Tue Apr 14 2015 16:25:47 GMT+0300 (Belarus Standard Time)