Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
Be there and give a shit

Felipe Oliveira feliperazeek

💭
Be there and give a shit
View GitHub Profile
View twitter.avsc
{
"type" : "record",
"name" : "twitter_schema",
"namespace" : "foo.bar",
"fields" : [ {
"name" : "username",
"type" : "string",
"doc" : "Name of the user account on Twitter.com"
}, {
"name" : "tweet",
View gist:5e621cd3245fae4723d2f943b040efde
### My publicly-auditable identity:
https://keybase.io/felipera
### From the command line:
Consider the [keybase command line program](https://keybase.io/download).
```bash
# look me up
View gist:8feb499216851612ed9de2def805aaae
import java.io.*;
import java.util.*;
public class Solution {
private static void work(int[] a) {
int swaps = 0;
int n = a.length;
@feliperazeek
feliperazeek / Solution.java
Created Oct 18, 2016
HackerRank - Cracking the Code Interview - Time Complexity: Primality (https://www.hackerrank.com/challenges/ctci-big-o)
View Solution.java
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
private static boolean isPrime(int n) {
if (n <= 1) return false;
@feliperazeek
feliperazeek / Solution.java
Created Oct 18, 2016
HackerRank - Cracking the Code Interview - Bit Manipulation: Lonely Integer (https://www.hackerrank.com/challenges/ctci-lonely-integer)
View Solution.java
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 Oct 15, 2016
HackerRank - Cracking the Code Interview - Queues: A Tale of Two Stacks (https://www.hackerrank.com/challenges/ctci-queue-using-two-stacks)
View Solution.java
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 Oct 14, 2016
HackerRank - Cracking the Code Interview - Sorting: Comparator (https://www.hackerrank.com/challenges/ctci-comparator-sorting)
View Checker.java
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 Oct 14, 2016
HackerRank - Cracking the Code Interview - Stacks: Balanced Brackets (https://www.hackerrank.com/challenges/ctci-balanced-brackets)
View Solution.java
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 Oct 14, 2016
HackerRank - Cracking the Code Interview - Arrays: Left Rotation (https://www.hackerrank.com/challenges/ctci-array-left-rotation)
View Solution.java
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 Oct 14, 2016
HackerRank and Cracking the Code Interview's Hash Tables: Ransom Note (https://www.hackerrank.com/challenges/ctci-ransom-note)
View Solution.java
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>();