Skip to content

Instantly share code, notes, and snippets.

View ShaneRich5's full-sized avatar
🏠
Working from home

Shane Richards ShaneRich5

🏠
Working from home
  • FTI Consulting
  • New York, NY
View GitHub Profile
import os
import json
from pprint import pprint
for filename in os.listdir('./'):
if (filename.endswith('.json')):
with open(filename, 'r') as json_file:
data = json.load(json_file)
if (data['email'] != data['username']):
from tweepy import OAuthHandler, Stream
from tweepy.streaming import StreamListener
class Listener(StreamListener):
def on_data(self, data):
print data
return True
def on_error(self, status):
#!/bin/python
import sys
def happy_ladybugs(n, bugs):
mappings = {}
free_cell = False
happy = True
for i, bug in enumerate(bugs):
@ShaneRich5
ShaneRich5 / super_reduced_string.java
Created May 24, 2017 12:40
Solution to the Super Reduce String problem on Hackerrank. https://www.hackerrank.com/challenges/reduced-string
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
StringBuilder s = new StringBuilder(scan.nextLine());
int i = 0;
@ShaneRich5
ShaneRich5 / mansa_stones.py
Created May 24, 2017 01:42
Solution to the Mansa Stones problem on Hackerrank. https://www.hackerrank.com/challenges/manasa-and-stones
for _ in xrange(test_cases):
n = int(raw_input()) - 1
a = int(raw_input())
b = int(raw_input())
low = a if a < b else b
high = a + b - low
diff = high - low
#!/bin/python
import csv
import xml.etree.ElementTree as ET
from util import prettify, capitalize
class AutoBuilder:
def __init__(self):
self.create_rss_element()
@ShaneRich5
ShaneRich5 / encription.py
Last active May 25, 2017 06:01
Solution to the Encryption problem on Hackerrank. https://www.hackerrank.com/challenges/encryption
#!/bin/python
import sys
from math import floor, ceil
sentence = raw_input().replace(" ", "")
size = len(sentence)
root = size ** .5
row = int(floor(root))
#!/bin/python
n, k = map(int, raw_input().split(' '))
queen_row, queen_column = map(int, raw_input().split(' '))
top = n - queen_row
bottom = queen_row - 1
right = n - queen_column
left = queen_column - 1
@ShaneRich5
ShaneRich5 / instruction.md
Last active May 10, 2020 23:58
Solution to the Queen Attack II Problem on Hackerrank. https://www.hackerrank.com/challenges/queens-attack-2

You are given a list of people who are attending ACM-ICPC World Finals. Each of them are either well versed in a topic or they are not. Find out the maximum number of topics a 2-person team can know. And also find out how many teams can know that maximum number of topics.

Note Suppose a, b, and c are three different people, then (a,b) and (b,c) are counted as two different teams.

Input Format

The first line contains two integers, and , separated by a single space, where represents the number of people, and represents the number of topics. lines follow. Each line contains a binary string of length . If the th line's th character is , then the th person knows the th topic; otherwise, he doesn't know the topic.

Constraints