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
""" | |
Island Count | |
Given a 2D array binaryMatrix of 0s and 1s, implement a function getNumberOfIslands that returns the number of islands of 1s in binaryMatrix. | |
An island is defined as a group of adjacent values that are all 1s. A cell in binaryMatrix is considered adjacent to another cell if they are next to each either on the same row or column. Note that two values of 1 are not part of the same island if they’re sharing only a mutual “corner” (i.e. they are diagonally neighbors). | |
Explain and code the most efficient solution possible and analyze its time and space complexities. | |
Example: |
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 datetime | |
from datetime import date | |
from datetime import timedelta | |
def IsDate(value): | |
return type(value) is date | |
class DateRange: | |
""" | |
Iterator over every date in a range [date_a, date_b). If a predicate is defined |
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
# Despues de revisar https://binary-coffee.dev/post/conociendo-el-ordenamiento-por-mezcla-merge-sort | |
# me animé a implementarlo en Python. | |
def MergeTwoOrderedLists(A, B): | |
""" | |
Merge two ordered lists. | |
:param A: a ordered collection with heterogeneous | |
comparable items with items in collection B | |
:param B: a ordered collection with heterogeneous |
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
# https://binary-coffee.dev/post/fechas-palindromos | |
from datetime import date | |
from datetime import timedelta | |
oneDay = timedelta(days=1) | |
def IsPalindromoDate(date): | |
strDate = str(date).replace('-', '') | |
return strDate == strDate[: : -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
# Despues de revisar https://binary-coffee.dev/post/insertion-sort | |
# me animé a implementarlo en Python. | |
def InsertionSort(A): | |
""" | |
Insertion sort algorithm. | |
:param A: some mutable ordered collection with heterogeneous | |
comparable items inside | |
:return: the same collection ordered by ascending |
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
# Funcion que calcula factoriales, ejemplo: | |
# $ factorial 10 5 | |
# 10: 3628800 | |
# 5: 120 | |
function factorial() | |
{ | |
if test $# -eq "0"; then | |
# Si no hay paraametros en la linea de comandos | |
# leemos de la entrada estandar. |
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
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace Utils | |
{ | |
public static class CollectionExtensions | |
{ | |
/// <summary> | |
/// Mutate collection by removing every item that predicate(item) is true. |
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
cents=$1 | |
time=$((cents*72 - 4)) | |
echo "Conectado por "$time" segundos" | |
# connecting using https://github.com/ateijelo/nauta-cli | |
python nauta.py up [your username] & |
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
using System; | |
using Timer = System.Timers.Timer; | |
namespace ConsoleApplication | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var timer = new Timer { Interval = 2000 }; // every two seconds |
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 12 columns, instead of 4. in line 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
Timestamp,Nombre completo: / Full name:,País: / Country:,Institución: / Institution:,¿Cómo se inició en la Programación Competitiva? / How did you started in Competitive Programming?,¿Cuántas veces ha participado en el Campamento Caribeño? / How many times have you participated in the Caribbean Camp?,¿En qué otros eventos de este tipo ha participado? / In what other similar events have you participated?,¿Cuáles recursos en línea utiliza o recomienda para el entrenamiento? / What online resources do you use or recommend for training?,¿Por cuánto tiempo ha sido entrenador? / How long have you been a coach?,¿Qué lo motivó a trabajar como entrenador? / What motivated you to serve as a coach?,"En el entrenamiento del equipo, ¿cuáles considera son sus tareas más significativas? / In the team's training, what do you consider are your most significant tasks?",¿Algo más que desee agregar? / Anything else you want to add? | |
3/5/2017 16:57:00,Dovier Antonio Ripoll Méndez,Cuba,Universidad de las Ciencias Informáticas (UCI) |
NewerOlder