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
# | |
# Hello World Program in Perl | |
# | |
print "\nHello World!\n"; | |
sub inRange | |
{ | |
(my $var,my @rng)=@_; | |
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
def entropy(x:Double, y:Double):Double = { | |
if(x==0 || y==0){ | |
0 | |
} else { | |
val p1 = x / (x + y) | |
val p2 = y / (x + y) | |
- (p1*math.log(p1) + p2*math.log(p2))/math.log(2) | |
} | |
} |
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
document.addEventListener('click', function(e) { console.log( | |
'page: ' + e.pageX + ',' + e.pageY, | |
'client: ' + e.clientX + ',' + e.clientY, | |
'screen: ' + e.screenX + ',' + e.screenY) }, false); |
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
# !/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import math | |
def prf(tlist, plist, n): | |
''' | |
cal the (precision, recall, f-score) | |
rlist:real values list |
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.util.Scanner; | |
import java.util.Stack; | |
public class MaxArea { | |
public static int maxArea(int[] heights) { | |
int max = Integer.MIN_VALUE; | |
Stack<Integer> inc = new Stack<Integer>(); | |
for (int i = 0; i < heights.length; i++) { | |
while (!inc.isEmpty() && heights[inc.peek()] > heights[i]) { |
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
#include <iostream> | |
#include <algorithm> | |
#include <string> | |
#include <vector> | |
#include <set> | |
#include <map> | |
static int cmp(int a, int b) { | |
return a > b; | |
} |
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
package mine.coding; | |
public class ReverseInsert { | |
private static class Node { | |
public int val; | |
public Node next; | |
public Node(int val) { | |
this.val = val; |
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
#!/usr/bin/python | |
# coding:utf-8 | |
import urllib2 | |
import BeautifulSoup | |
import re | |
import os | |
HOST = u'http://www.washingtonpost.com/' | |
image_patt = re.compile('.*photo-wrapper') |
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.util.Scanner; | |
public class Main { | |
static int sumTime(int[] arr, int upcost, int downcost, int stopcost){ | |
int up=arr[0], down=0, stop=arr.length; | |
for(int i=1; i<arr.length; i++){ | |
int diff = arr[i] -arr[i-1]; | |
if(diff>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
//============================================================================ | |
// Name : Coding.cpp | |
// Author : Plex | |
// Version : 1.0 | |
// Copyright : Your copyright notice | |
// Description : Hello World in C++, Ansi-style | |
//============================================================================ | |
#include <iostream> | |
#include <string> | |
#include <string.h> |
NewerOlder