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
| use std; | |
| fn is_fizzbuzz(x:int) -> bool { x % 15 == 0} | |
| fn is_fizz(x:int) -> bool { x % 3 == 0} | |
| fn is_buzz(x:int) -> bool { x % 5 == 0} | |
| fn fizzbuzz(n:int) -> str { | |
| ret | |
| if is_fizzbuzz(n) { "fizzbuzz"} | |
| else if is_fizz(n) { "fizz" } |
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
| use std; | |
| fn sort(v: [int]) -> [int] { | |
| let len = vec::len(v) as int; | |
| if len < 2 { ret v; } | |
| let i = 0; | |
| let pivot = v[(len-1)/2]; | |
| let lv = [], rv = []; | |
| while i < len { |
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
| use std; | |
| fn factorial(n: int) -> int { | |
| if n == 0 {ret 1; } | |
| else {ret n * factorial(n - 1); } | |
| } | |
| fn bt(n: int, k: int) -> int { | |
| ret factorial(n) / (factorial(n -k) * factorial(k)); | |
| } |
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
| use std; | |
| fn iter<T>(seq: [T], f: block(T)) { | |
| for elt: T in seq { | |
| f(elt); | |
| } | |
| } | |
| fn main() { | |
| let array :[str] = ["test", "test2", "test3"]; |
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 android.app.ActionBar; | |
| import android.app.ActionBar.Tab; | |
| import android.app.ActionBar.TabListener; | |
| import android.app.Activity; | |
| import android.app.FragmentTransaction; | |
| import android.os.Bundle; | |
| import android.view.Menu; | |
| import android.view.MenuItem; | |
| import android.view.Window; |
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
| typedef enum boolean_ { | |
| false = 0, | |
| true = 1 | |
| } boolean; |
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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #define N 8 | |
| typedef enum boolean_ { | |
| false = 0, | |
| true = 1 | |
| } boolean; |
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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <assert.h> | |
| typedef struct sNode Node; | |
| struct sNode { | |
| int value; | |
| Node *left; | |
| Node *right; | |
| }; |
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
| <html> | |
| <head> | |
| <script src="http://api.dmcdn.net/all.js"></script> | |
| <script type="text/javascript"> | |
| var videoArray = new Array(); | |
| var j = 0; | |
| window.dmAsyncInit = function() { | |
| DM.api('/videos', {search: "momoclo"}, function(response) { | |
| console.log(response.list[0]); |
OlderNewer