This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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; | |
| ... |
OlderNewer