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
/* | |
* http://stackoverflow.com/questions/6215185/getting-length-of-video | |
*/ | |
using DirectShowLib; | |
using DirectShowLib.DES; | |
using System.Runtime.InteropServices; | |
... |
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 leon.lang._ | |
import leon.collection._ | |
abstract class Stack[T] { | |
def empty : Stack[T] | |
def pop : (Option[T], Stack[T]) | |
def push (e : T) : Stack[T] | |
def size : BigInt | |
} |
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
/** | |
* Definition for singly-linked list with a random pointer. | |
* class RandomListNode { | |
* int label; | |
* RandomListNode next, random; | |
* RandomListNode(int x) { this.label = x; } | |
* }; | |
*/ | |
public class RecursiveVersion { | |
public RandomListNode copyRandomList(RandomListNode head) { |
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
/** | |
* Definition for singly-linked list with a random pointer. | |
* struct RandomListNode { | |
* int label; | |
* RandomListNode *next, *random; | |
* RandomListNode(int x) : label(x), next(NULL), random(NULL) {} | |
* }; | |
*/ | |
class Solution { | |
public: |
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
/* matchhere: search for regexp at beginning of text */ | |
int matchhere(char *regexp, char *text) | |
{ | |
if (regexp[0] == '\0') | |
return 1; | |
if (regexp[1] == '*') | |
return matchstar(regexp[0], regexp+2, text); | |
if (regexp[0] == '$' && regexp[1] == '\0') | |
return *text == '\0'; | |
if (*text!='\0' && (regexp[0]=='.' || regexp[0]==*text)) |
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
object Main { | |
class Regex | |
case class Literal(s: String) extends Regex | |
case class Concat(r1: Regex, r2: Regex) extends Regex | |
case class Choice(r1: Regex, r2: Regex) extends Regex | |
case class Star(r: Regex) extends Regex | |
def accept(regex: Regex, chars: Seq[Char], k: Seq[Char] => Boolean): Boolean = | |
regex match { |
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
function interpret(form, env, ctx){ | |
if(form instanceof Array){ | |
switch(form[0]){ | |
case 'lambda': { | |
var params = form[1]; | |
var body = form[2]; | |
return ctx(function(ctx){ return function() { | |
var e = Object.create(env); | |
for(var j = 0; j < params.length; j++) | |
e[params[j]] = arguments[j]; |
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
/** | |
* Definition for singly-linked list. | |
* class ListNode { | |
* int val; | |
* ListNode next; | |
* ListNode(int x) { | |
* val = x; | |
* next = null; | |
* } | |
* } |
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
public class Solution { | |
/** | |
* This is a O(n) algorithm for finding the area of the largest rectangle | |
* in histogramand and is a simple version of Daveed V's optimal algorithm | |
* for finding the largest rectangle in a 2D matrix. | |
* See https://gist.github.com/ericpony/15c1a126980f36652e6a for details. | |
*/ | |
public int largestRectangleArea(int[] height) { | |
if(height==null || height.length==0) |
NewerOlder