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
""" | |
Find all possible combinations of k numbers that add up to a number n, | |
given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers. | |
For example: if n = 7 k = 3 | |
ans [1,2,4] | |
k = 3 n = 9 | |
[[1,2,6], [1,3,5], [2,3,4]] | |
""" |
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
To Watch | |
- The Room | |
- Brooklyn | |
- There's no tomorrow | |
- True Cost | |
- Ghetto Physics | |
- Garbage warriors | |
- P Sainath Corporate hijack of Indian agriculture | |
Watched |
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
class Event { | |
int start; | |
int end; | |
} | |
class myE { | |
int isStart; | |
int time; | |
} | |
void maxparticipants(event[] events){ |
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
timeline = { | |
'1': set([0,1,2,3,4]), | |
'2': set([3,4,5,6,7]), | |
'3': set([2,3,4])} | |
def get_meeting_time(timeline): | |
""" | |
get intersection of all the person | |
""" |
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
'use strict'; | |
module.exports = function mochacli(grunt) { | |
// Load task | |
grunt.loadNpmTasks('grunt-mocha-cli'); | |
// Options | |
return { | |
src: ['test/unit/**/*.js'], |
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
""" | |
Buckets Robo problem | |
Attempt #1 | |
""" | |
begin = -1; | |
end = len(no_of_buckets); | |
loc = 0; | |
while (loc<end) { | |
switch (color) { |
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 reverse(_string): | |
return ''.join(reversed(_string)) |
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 is_valid(grid): | |
if len(grid)!=81: | |
return False | |
for a in grid: | |
val = int(a) | |
if type(val)!= int or val == 0: | |
return False | |
k = 0 | |
puzzle = [[0 for x in xrange(9)] for x in xrange(9)] |
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
class Info: | |
def __init__(self, index, name): | |
self.name = name | |
self.index = index | |
def __repr__(self): | |
return repr((self.name, self.index)) | |
inf1 = Info(2, "two") | |
inf2 = Info(1, "one") | |
inf3 = Info(-1, "Minus-one") |
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
from decimal import * | |
getcontext().prec = 15 | |
t=[] | |
for i in range(int(raw_input())): | |
t.append(raw_input()) | |
for i in range(len(t)): | |
o=t[i] | |
l=[] | |
for j in range(int(o)): | |
p=Decimal((2*j) + 1) |
NewerOlder