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/python3 | |
# I hadn't considered using a max-heap for this question as I believed it would have an O(nlog(n)) solution, | |
# but having considered it again this is better solution than what I thought of yesterday | |
# O(n) to build the heap and O(klog(n)) to get k largest numbers | |
# This puts the complexity via this method at O(n + klog(n)) which should be better than both, my O(kn) solution or the general O(nlog(n)) | |
# via sorting method | |
class MaxHeap: | |
def __init__(self, arr): |
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
// Written by utkarsh raj | |
Text here |
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
#!/bin/python3 | |
# Python 3 required !! | |
# do 'pip3 install pysocks' for socks module | |
import sys | |
import socket | |
try: | |
import socks | |
except ImportError: | |
print('Pysocks not installed, do "pip3 install pysocks"') |
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/env/python3 | |
import sys | |
import subprocess | |
import random | |
import threading | |
import logging | |
import time | |
import re | |
INFI = float('inf') |
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 asyncio | |
import aiohttp | |
import bs4 | |
import tqdm | |
@asyncio.coroutine | |
def get(*args, **kwargs): | |
response = yield from aiohttp.request('GET', *args, **kwargs) | |
return (yield from response.read_and_close(decode=True)) |