Skip to content

Instantly share code, notes, and snippets.

View roa-sh's full-sized avatar
🥝

Juan Manuel Roa Mejia roa-sh

🥝
View GitHub Profile
import sys
def main():
#Read Arguments
arch = sys.argv[1]
#print("Nombre archivo",arch)
#Read file
file = open(arch, "r").read()
#replace \n to whitespace
file = file.replace('\n',' ')
@roa-sh
roa-sh / dag.py
Created April 27, 2021 15:06
Segunda prueba donde se encuentra el numero de ciclos.
import sys
def main():
#Read Arguments
arch = sys.argv[1]
#print("Nombre archivo",arch)
#Read file
file = open(arch, "r").read()
#replace \n to whitespace
file = file.replace('\n',' ')
@roa-sh
roa-sh / anagrams.rb
Created June 12, 2024 16:50
Anagrams Ruby Exercise
#* Write a Ruby method group_anagrams that takes an array of strings as input
#* and groups the anagrams together.
#* Anagrams are words or phrases formed by rearranging the letters of another.
def group_anagrams(words)
groups = {}
words.each_with_index do |word, index|
sorted_word = word.chars.sort.join
if groups[sorted_word].nil?
groups[sorted_word] = [word]