Skip to content

Instantly share code, notes, and snippets.

View libert-xyz's full-sized avatar
🗽
/dev/urandom

Libert Schmidt libert-xyz

🗽
/dev/urandom
View GitHub Profile
@libert-xyz
libert-xyz / set_hacker.py
Created June 30, 2016 16:49
Sets - Symmetric Difference
#6/30/16
#https://www.hackerrank.com/challenges/sets/forum
raw_input()
n1 = set(map(int,(raw_input().split())))
raw_input()
n2 = set(map(int,(raw_input().split())))
u = n1.symmetric_difference(n2)
@libert-xyz
libert-xyz / secondLarger_hack.py
Created July 1, 2016 17:01
NOTE: Do not use the insertion sort method.
#7/1/16
#https://www.hackerrank.com/challenges/find-second-maximum-number-in-a-list
int(raw_input())
n = map(int,raw_input().split())
maxi = max(n)
@libert-xyz
libert-xyz / nested_hacker.py
Created July 2, 2016 05:49
There will always be one or more students having the second lowest grade.
#https://www.hackerrank.com/challenges/nested-list
#7/2/16
n = int(raw_input())
student = []
for i in range(n):
student.append([raw_input(),float(raw_input())])
@libert-xyz
libert-xyz / sWAPcASE.py
Created July 2, 2016 18:06
Your task is to swap cases. In other words, convert all lowercase letters to uppercase letters and vice versa. (Without swapcase() )
#7/2/16
#https://www.hackerrank.com/challenges/swap-case
s = [i.lower() if i.isupper() else i.upper() for i in raw_input()]
print ''.join(s)
#7/2/16
#https://www.hackerrank.com/challenges/itertools-product
from itertools import product
a = map(int,raw_input().split())
b = map(int,raw_input().split())
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "statement1",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::acct:user/devuser"
},
"Action": [
#07/10/16
#https://www.hackerrank.com/challenges/find-a-string
s1 = raw_input()
s2 = raw_input()
tam = len(s2)
c = 0
for i in range(0,len(s1)):
if s1[i] == s2[0]:
#7/15/16
#https://www.hackerrank.com/challenges/text-alignment
ti = int(raw_input()) #an odd number
c = '@'
w = ' '
#Top
for i in range(ti):
@libert-xyz
libert-xyz / ec2simple.json
Created July 27, 2016 04:05
simple ec2 with a security group
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "Create an Amazon EC2 instance running the Amazon Linux AMI. The AMI is chosen
based on the region in which the stack is run. This example creates an EC2 security group for the instance
to give you SSH access.",
"Parameters" : {
"KeyName": {
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instance",
@libert-xyz
libert-xyz / designerDoor.py
Created August 1, 2016 16:32
A single line containing the space separated values of N and M.
#08/1/16
#https://www.hackerrank.com/challenges/designer-door-mat
N, M = map(int,input().split()) # More than 6 lines of code will result in 0 score. Blank lines are not counted.
for i in range(1,N,2):
print ((i*".|.").center(M,"-"))
print ("WELCOME".center(M,"-"))
for i in range(N-2,-1,-2):
print ((i*".|.").center(M,"-"))