This file contains 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 random | |
import collections | |
def generateHand(size, maxcard): | |
r = [] | |
for i in range(size): | |
r.append(random.randint(1, maxcard)) | |
return r |
This file contains 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
characters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', | |
'V', 'W', 'X', 'Y', 'Z'] | |
nletters = len(characters) | |
ndigits = 6 | |
def prires(letters, x): | |
ret = "" | |
for l in letters: | |
ret = ret + characters[l] | |
if x > 0: |
This file contains 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.Arrays; | |
public class Principal { | |
public static int findMin(int input[]){ | |
System.out.println("Min steps: 1"); | |
if (input[0] < input[input.length-1]) | |
return input[0]; | |
return input[input.length-1]; | |
} | |
This file contains 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
function getMaxMin(array) { | |
let min | |
let max = Number.MIN_VALUE | |
if (array.length > 0) { | |
min = Math.min(array[0], array[array.length - 1]) | |
} | |
return { max: getMax(array, max), min: min } |
This file contains 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
let data = [4,9,13,102,103,101,25,22,21,20,18,9,1] | |
function min(data) { | |
return Math.min(data[0], data[data.length-1]) | |
} | |
function max(data, index) { | |
index = !index ? Math.floor(data.length / 2) : index | |
let left = data[index-1] |