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 fileinput | |
import sys | |
sys.setrecursionlimit(10000) | |
def solve(houses, transmitter_range): | |
houses.sort(reverse=True) | |
if len(houses) == 0: | |
return 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
""" | |
https://www.hackerrank.com/challenges/luck-balance | |
[(6, 3), (5, 1), (2, 1), (1, 1), (8, 1), (10, 0), (5, 0),] | |
""" | |
import fileinput | |
def data_stream(): |
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 | |
import fileinput | |
def data_stream(): | |
for line in fileinput.input(): | |
line = line.strip() | |
yield line |
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
# A dictionary comprehension: | |
a = {num: Node(num) for num in range(1, 8)} | |
``` | |
a now looks like: | |
{1: Node(data=1, next_node=None), | |
2: Node(data=2, next_node=None), | |
3: Node(data=3, next_node=None), | |
4: Node(data=4, next_node=None), | |
5: Node(data=5, next_node=None), |
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 ).ready(function() { | |
var replace_text_element_with_provinces = function(text_element) { | |
/* | |
Accepts a reference to a form's text element, builds a select | |
element populated with Canadian provinces and replaces the text | |
element with the select element. | |
*/ | |
var provinces = $("#id_country").data("provinces"); |
NewerOlder