Skip to content

Instantly share code, notes, and snippets.

View feliperazeek's full-sized avatar
💭
Be there and give a shit

Felipe Oliveira feliperazeek

💭
Be there and give a shit
View GitHub Profile
@feliperazeek
feliperazeek / Solution.java
Created October 18, 2016 05:13
HackerRank - Cracking the Code Interview - Bit Manipulation: Lonely Integer (https://www.hackerrank.com/challenges/ctci-lonely-integer)
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static int lonelyInteger(int[] a) {
int i = 0;
@feliperazeek
feliperazeek / Solution.java
Created October 15, 2016 04:41
HackerRank - Cracking the Code Interview - Queues: A Tale of Two Stacks (https://www.hackerrank.com/challenges/ctci-queue-using-two-stacks)
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
private static class MyQueue<T> {
@feliperazeek
feliperazeek / Checker.java
Created October 14, 2016 22:09
HackerRank - Cracking the Code Interview - Sorting: Comparator (https://www.hackerrank.com/challenges/ctci-comparator-sorting)
public class Checker implements Comparator<Player> {
public int compare(Player p1, Player p2) {
int score = Integer.compare(p2.score, p1.score);
if (score != 0) return score;
else return p1.name.compareTo(p2.name);
}
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
@feliperazeek
feliperazeek / Solution.java
Created October 14, 2016 06:13
HackerRank - Cracking the Code Interview - Stacks: Balanced Brackets (https://www.hackerrank.com/challenges/ctci-balanced-brackets)
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
private static List<Character> openChars = new ArrayList<Character>(Arrays.asList('{', '(', '['));
private static List<Character> closeChars = new ArrayList<Character>(Arrays.asList('}', ')', ']'));
@feliperazeek
feliperazeek / Solution.java
Created October 14, 2016 05:51
HackerRank - Cracking the Code Interview - Arrays: Left Rotation (https://www.hackerrank.com/challenges/ctci-array-left-rotation)
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static int[] arrayLeftRotation(int[] a, int n, int k) {
if (k < 0) throw new RuntimeException("K needs to be greater than zero");
@feliperazeek
feliperazeek / Solution.java
Created October 14, 2016 05:48
HackerRank and Cracking the Code Interview's Hash Tables: Ransom Note (https://www.hackerrank.com/challenges/ctci-ransom-note)
import java.util.*;
public class Solution {
Map<String, Integer> magazineMap;
Map<String, Integer> noteMap;
public Solution(String magazine, String note) {
magazineMap = new HashMap<String, Integer>();
noteMap = new HashMap<String, Integer>();
@feliperazeek
feliperazeek / Solution.java
Created October 14, 2016 05:37
HackerRank - Cracking Code Interview - Strings: Making Anagrams (https://www.hackerrank.com/challenges/ctci-making-anagrams)
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
public static int numberNeeded(String first, String second) {
Map<Character, Integer> fmap = getCharacterMap(first);
[{
"name": "felipe",
"age": 33
}, {
"name": "ty",
"age": 3
}]
@feliperazeek
feliperazeek / SimpleTriggerPlugin.java
Created February 23, 2016 01:14
Azkaban Simple Trigger Plugin
package azkaban.security;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
spring_profiles: postgresql
database:
driverClassName: org.postgresql.Driver
url: jdbc:postgresql://uaa.ccbvglwadavl.us-west-2.rds.amazonaws.com:5432:/uaa
username: uaa
password: uaauaauaa
jwt:
token: