Skip to content

Instantly share code, notes, and snippets.

View anushkrishnav's full-sized avatar
:octocat:
work work work

Anush Venkatakrishnan anushkrishnav

:octocat:
work work work
View GitHub Profile
@anushkrishnav
anushkrishnav / Links.md
Last active January 16, 2021 11:38
Intro to git and Github
@anushkrishnav
anushkrishnav / Hackathon Starter Templates.md
Last active October 3, 2020 16:06
Hackathon Starter Templates
#Definition for a binary tree node.
from collections import deque
class TreeNode:
def __init__(self, val=0, left=None, right=None):
self.val = val
self.left = left
self.right = right
class Solution:
def rightSideView(self, root: TreeNode) -> List[int]:
k=[]
<title>locust</title>
"""
Final Project for Week 4 of "Python Programming Essentials"
Collection of functions to process dates.
"""
import datetime
def days_in_month(year, month):
"""
Inputs:
'''
Author : @anushkrishnav
Built using : networkx since it is a gold standard for Python DAGs (and other graphs). You can create a networkx directed graph with a list of tuples that represent the graph edges:
'''
import networkx as nx
from matplotlib import pyplot as plt
class DAG:
def __init__(self):
self.graph=nx.DiGraph()
def addEdges(self,edges):
""" This file contains the code for week 3 Project """
import csv
def read_csv_fieldnames(filename, separator, quote):
"""
Inputs:
filename - name of CSV file
separator - character that separates fields
quote - character used to optionally quote fields
@anushkrishnav
anushkrishnav / Emo.txt
Last active July 19, 2020 18:38
Emoji Sheet
People
:bowtie:
:smile:
:laughing:
:blush:
:smiley:
:relaxed:
:smirk:
:heart_eyes:
@anushkrishnav
anushkrishnav / README.md
Last active December 6, 2020 14:38
Profile

Username
username=your username goes here
Customising it
You can get color codes at https://htmlcolorcodes.com/
Use Hex colour codes eg
for Black title colour
replace title_color=8fe9e0
with title_color=0B0A0A

Hey, I Already Did That!
========================
Commander Lambda uses an automated algorithm to assign minions randomly to tasks, in order to keep her minions on their toes. But you've noticed a flaw in the algorithm - it eventually loops back on itself, so that instead of assigning new minions as it iterates, it gets stuck in a cycle of values so that the same minions end up doing the same tasks over and over again. You think proving this to Commander Lambda will help you make a case for your next promotion.
You have worked out that the algorithm has the following process:
1) Start with a random minion ID n, which is a nonnegative integer of length k in base b
2) Define x and y as integers of length k. x has the digits of n in descending order, and y has the digits of n in ascending order
3) Define z = x - y. Add leading zeros to z to maintain length k if necessary