Skip to content

Instantly share code, notes, and snippets.

View mikaelsouza's full-sized avatar
Working from home

Mikael Souza mikaelsouza

Working from home
View GitHub Profile
class Solution:
def __init__(self):
self.visited = {}
def startWalking(self, heights: List[List[int]], i: int, j: int):
self.visited = {}
up_left = self.walkThroughMatrix(heights, i, j, up_left=True)
self.visited = {}
down_right = self.walkThroughMatrix(heights, i, j, up_left=False)
return up_left and down_right
print("Hello World!")
mikaelsouza /
Created November 2, 2022 23:19 — forked from EduardoRFS/
type term = Var of string | Lam of string * term | App of term * term
type value = Closure of ((string * value) list * string * term)
let rec eval env term =
match term with
| Var var -> List.assoc var env
| Lam (param, body) -> Closure (env, param, body)
| App (lambda, argument) -> (
let lambda = eval env lambda in
let argument = eval env argument in
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
device = torch.device('cpu')
# generating vocab
sentences = [
mikaelsouza /
Last active January 13, 2020 20:43
Implementação de um HashMap simples em Python
class HashMap(object):
def __init__(self, bucket_size=10):
self.bucket_size = bucket_size
self.buckets = [None] * self.bucket_size
def insert(self, key, value):
hashed_key = hash(key)
bucket_index = hashed_key % self.bucket_size
self.buckets[bucket_index] = value
import warnings
import math
from functools import reduce
import collections
from collections import defaultdict
import numpy as np
from keras.datasets import mnist
from sklearn.tree import DecisionTreeClassifier
from sklearn.preprocessing import KBinsDiscretizer
from math import log2
import numpy as np
import sklearn.datasets as datasets
from keras import layers, models, utils
def main():
# Loading dataset
boston_dataset = datasets.load_boston()
# Defining inputs and outputs of the neural network