.
├── README.md
├── data
├── evaluation
├── models
├── notebook
├── requirements.txt
├── results
├── singularity_python.sh
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 substrings(words, dictionary) | |
result = Hash.new(0) | |
words = words.split(" ") | |
dictionary.map do |dict| | |
words.each do |word| | |
if word.downcase.include?(dict.downcase) | |
result[dict] += 1 | |
end | |
end | |
end |
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 stonk_picker(stonk_arr) | |
# find the max diff between elements | |
max_profit = 0 | |
max_idx = [0, 0] | |
stonk_arr.each_with_index do |buy, buy_idx| | |
stonk_arr.each_with_index do |sell, sell_idx| | |
# puts "%d %d" % [buy_idx, sell_idx] | |
if buy_idx < sell_idx && sell - buy > max_profit | |
max_idx[0] = buy_idx | |
max_idx[1] = sell_idx # get original idx |
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 bubble_sort(arr) | |
# drop ignores previous sorted elems | |
arr.each_with_index do |dum, drop_i| | |
arr.drop(drop_i).each_with_index do |elem, i| | |
if arr[i+1] != nil && arr[i] > arr[i + 1] | |
temp = arr[i] | |
arr[i] = arr[i+1] | |
arr[i+1] = temp | |
end | |
end |
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
class Board | |
attr_accessor :board_config | |
def initialize | |
@board_config = [["_", "_", "_"], ["_", "_", "_"], ["_", "_", "_"]] # 3 by 3 | |
@dim = 3 | |
end | |
def lookup(coord) | |
return @board_config[coord[0]][coord[1]] |
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
╔══════════════════╦══════════════════════╗ | |
║ ecosystem ║ number of packages ║ | |
╠══════════════════╬══════════════════════╣ | |
║ Python’s `pip` ║ 235000 ║ | |
║ Ruby’s gem ║ 133000 ║ | |
║ Javascript’s NPM ║ 1m+ ║ | |
╚══════════════════╩══════════════════════╝ |
OlderNewer