Skip to content

Instantly share code, notes, and snippets.

View abhishek-jaisingh's full-sized avatar
:electron:
👨‍💻

Abhishek Jaisingh abhishek-jaisingh

:electron:
👨‍💻
View GitHub Profile
@abhishek-jaisingh
abhishek-jaisingh / magic_powder.cpp
Created June 18, 2016 16:11
MAGIC POWDER - binary search approach
#include <bits/stdc++.h>
using namespace std;
#define sd(a) scanf("%d", &a)
#define sl(a) scanf("%lld", &a)
#define ll long long
ll a[100010], b[100010];
int main()
@abhishek-jaisingh
abhishek-jaisingh / subset_sum.cpp
Created February 9, 2016 10:11
Subset Sum DP
#include <bits/stdc++.h>
using namespace std;
void printer(int** a, int r, int c)
{
cout << endl;
for ( int i = 0 ; i <= r ; i++ )
{
for ( int j = 0 ; j <= c ; j++ )
{
cout << a[i][j] << " ";
@abhishek-jaisingh
abhishek-jaisingh / adventofcodeday8.py
Created December 22, 2015 21:59
Advent of Code Day 8 Python Code Solution
def readfile(filename):
with open(filename, "r") as f:
tot = 0
for line in f.readlines():
line = line[:len(line)-1]
l = len(line)
count = 0
print(line)
for ch in line:
if ch in ['\\' ,'\"']:
@abhishek-jaisingh
abhishek-jaisingh / AdventOfCodeDay7.py
Created December 22, 2015 18:20
Advent of Code Day 7 Python Code Solution PS: Just basic recursion and memoization
def getdata(filename):
d = dict()
with open(filename, "r") as f:
for line in f.readlines():
line = line.replace('\n', '').split(' -> ')
d[line[1]] = line[0]
return d
def evaluate(var, d):
try:
val = int(var)