Skip to content

Instantly share code, notes, and snippets.

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

Antonio Borrero Granell antoniobg

🏠
Working from home
View GitHub Profile
@antoniobg
antoniobg / antoniobg.sublime-keymap
Created December 3, 2015 09:30
Sublime keybindings
[
{ "keys": ["alt+space"], "command": "insert", "args": {"characters": " "} },
{ "keys": ["alt+shift+space"], "command": "insert", "args": {"characters": " "} },
{
"keys": ["super+alt+down"],
"command": "set_layout",
"args":
{
"cols": [0.0, 1.0],
"rows": [0.0, 0.5, 1.0],
@antoniobg
antoniobg / ParenthesisChecker.java
Created September 28, 2014 18:26
ParenthesisChecker
public class ParenthesisChecker {
public void isValid(String s) throws Exception {
// Adds one for each open parenthesis, and subtracts one for each closed parenthesis
// In the end, count must be 0 and count can't be lower than 0 at any time.
int count = 0;
for(int i = 0; i < s.length(); i++) {
char current = s.charAt(i);
def build_array
participants = []
file = File.open("participantes.csv")
file.each do |line|
participants << line
end
participants
end
def get_winner(participants)
@antoniobg
antoniobg / CognimaTask1.java
Last active August 29, 2015 14:04
Task1 - Cognima
import java.util.Scanner;
public class Task1 {
public static long hash(String s) {
long h = 7;
String letters = "acdegilmnoprstuw";
for(int i = 0; i < s.length(); i++)
h = (h * 37 + letters.indexOf(s.charAt(i)));
import java.util.HashMap;
import java.util.HashSet;
/**
* Given an input like:
*
* [2, 4]
* [1, 2]
* [3, 6]
* [1, 3]