Skip to content

Instantly share code, notes, and snippets.

View mh-github's full-sized avatar

Mahboob Hussain mh-github

View GitHub Profile
@mh-github
mh-github / fiful.rb
Created February 21, 2015 19:56
Ruby example for function in a function by using lambda
def outer(a)
b = 6
l = lambda do |a, b|
print a + b
end
l.call(a, b)
end
outer(5)
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Solution {
public static void main(String args[]) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
long n = 0;
#include <stdio.h>
#define NUM 2000
int main(int argc, char* argv[])
{
signed long pow[NUM],val[NUM],x,num,ten;
int i,j,count;
for(num=2; num<NUM; num++)
{
for(i=0; i<NUM; pow[i++]=0);
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
public class n_multiple_Min_N_Zeros_Ones
{
NUM = 2000
pow, val = [], []
2.upto NUM-1 do |num|
0.upto(NUM-1) {|i| pow[i] = 0 }
count, ten, x = 0, 1, 1
while (x < NUM) do
val[x] = ten
0.upto NUM-1 do |j|
#!/usr/bin/python
#
# Created by Albert Au Yeung (2010)
#
# An implementation of matrix factorization
#
try:
import numpy
except:
print "This implementation requires the numpy module."
require 'nmatrix'
require 'pp'
###############################################################################
=begin
@INPUT:
r : a matrix to be factorized, dimension n x m
p : an initial matrix of dimension n x k
q : an initial matrix of dimension m x k
<persons xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="family.xsd">
<person>
<full_name>Hege Refsnes</full_name>
<child_name>Cecilie</child_name>
</person>
<person>
<full_name>Tove Refsnes</full_name>
<xs:element name="persons">
<xs:complexType>
<xs:sequence>
<xs:element name="person" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="full_name" type="xs:string"/>
<xs:element name="child_name" type="xs:string"
minOccurs="0" maxOccurs="5"/>
</xs:sequence>
<shoesize country="france">35</shoesize>