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
openapi: 3.0.0 | |
info: | |
title: Mateus API | |
description: A simple API with one route | |
version: 1.0.0 | |
paths: | |
/hello: | |
get: | |
summary: Get a friendly greeting | |
description: Returns a simple greeting message |
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 getRandomIntInclusive(min, max) { | |
min = Math.ceil(min); | |
max = Math.floor(max); | |
return Math.floor(Math.random() * (max - min + 1) + min); //The maximum is inclusive and the minimum is inclusive | |
} | |
const genArr = () => { | |
const arr = []; | |
for(let i = 0; i < getRandomIntInclusive(0, 100); i++){ | |
arr.push(getRandomIntInclusive(0, 100)) |
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 removeIslands from '../../src/remove-islands'; | |
describe('removeIslands', () => { | |
it('should work 1', () => { | |
expect(removeIslands([ | |
[1, 0, 0, 0, 0, 0], | |
[0, 1, 0, 1, 1, 1], | |
[0, 0, 1, 0, 1, 0], | |
[1, 1, 0, 0, 1, 0], | |
[1, 0, 1, 1, 0, 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
function createMatrix(rows: number, colls: number) : number[][] { | |
const matrix = []; | |
for (let i = 0; i < rows; i++) { | |
const row = []; | |
for (let j = 0; j < colls; j++) { | |
row.push(0); | |
} | |
matrix.push(row); | |
} | |
return matrix; |
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
(ns tutorial.fibonacci | |
(:gen-class)) | |
(defn fibonacci | |
"Returns the fibonacci sequence of a given length" | |
[ len ] | |
(def fibonacci-sec (atom (seq [ 0 1 ]))) | |
(dotimes [counter (- len 2)] | |
(def first-num (nth @fibonacci-sec counter)) | |
(def sec-num (nth @fibonacci-sec (+ counter 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
(ns tutorial.string-utils | |
(:gen-class)) | |
(defn invert_str | |
"Invert a string" | |
[value] | |
(def end (- (count value) 1)) | |
(loop [index end result ""] | |
(if (not= -1 index) | |
(recur (- index 1) (str result (.charAt value index))) (println result)))) |
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
(ns tutorial.cpf | |
(:gen-class)) | |
(defn validate_first_part | |
[cpf] | |
(loop [index 0 counter 0] | |
(def incre (* (- 10 index) (Integer/parseInt (.toString (.charAt cpf index))))) | |
(if (= index 9) | |
(do | |
(def lastDigit (Integer/parseInt (.toString (.charAt cpf 9)))) |
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
# Number of Visible Nodes | |
# There is a binary tree with N nodes. You are viewing the tree from its left side and can see only the leftmost nodes at each level. Return the number of visible nodes. | |
# Note: You can see only the leftmost nodes, but that doesn't mean they have to be left nodes. The leftmost node at a level could be a right node. | |
# Signature int visibleNodes(Node root) { | |
# InputThe root node of a tree, where the number of nodes is between 1 and 1000, and the value of each node is between 0 and 1,000,000,000 | |
# OutputAn int representing the number of visible nodes. | |
# Example | |
# 8 <------ root | |
# / \ | |
# 3 10 |
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
<?php | |
/** | |
* Validates a 2-digit area code not composed by zeroes. | |
* @link http://www.anatel.gov.br/legislacao/resolucoes/16-2001/383-resolucao-263. | |
* @return bool | |
*/ | |
function validate (string $areaCode): bool | |
{ |
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
Install Hyper | |
Website: | |
https://hyper.is/ | |
Install ZSH: | |
https://github.com/ohmyzsh/ohmyzsh/wiki/Installing-ZSH | |
Install Oh My Zsh |
NewerOlder