This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.HashMap; | |
import java.util.HashSet; | |
/** | |
* Given an input like: | |
* | |
* [2, 4] | |
* [1, 2] | |
* [3, 6] | |
* [1, 3] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def build_array | |
participants = [] | |
file = File.open("participantes.csv") | |
file.each do |line| | |
participants << line | |
end | |
participants | |
end | |
def get_winner(participants) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
[ | |
{ "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], |