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
''' | |
Problem statement: | |
you have input list: L0 -> L1 -> L2 -> ..... -> Ln -> Ln-1 | |
output: L0 -> Ln -> L1 -> Ln-1 -> L2 -> Ln-2 -> .... | |
''' | |
class Node(object): | |
def __init__(self, val, _next=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
import operator | |
""" | |
Question: | |
Sort the characters in the following string: | |
abcdefghijklmnopqrstuvwxyz_ | |
by the number of times the character appears in the following text (descending): |
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
Traceback (most recent call last): | |
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1836, in __call__ | |
return self.wsgi_app(environ, start_response) | |
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1820, in wsgi_app | |
response = self.make_response(self.handle_exception(e)) | |
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1403, in handle_exception | |
reraise(exc_type, exc_value, tb) | |
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1817, in wsgi_app | |
response = self.full_dispatch_request() | |
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1477, in full_dispatch_request |
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 operator | |
ops = {'+':operator.add,'-':operator.sub,'*':operator.mul,'/':operator.div} | |
class Stack: | |
def __init__(self): | |
self.mylist = [] | |
def isempty(self): | |
return True if len(self.mylist) == 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
from inspect import getmembers, getargspec, ismethod | |
from functools import wraps | |
from decorator import decorator | |
# Some super basic decorators | |
def std_decorator(f): | |
def std_wrapper(*args, **kwargs): | |
return f(*args, **kwargs) | |
return std_wrapper |