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
function getPrimes(n) { | |
if (n <= 1) { | |
return "O inteiro n deve ser maior do que 1."; | |
} | |
const isPrime = []; | |
for (let i = 0; i <= n; i++) { | |
isPrime[i] = true; | |
} |
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
function isPrime(num, divider = 2) { | |
if (num <= 2) { | |
return true; | |
} | |
if (num % divider === 0) { | |
return false; | |
} | |
if (divider * divider > num) { |
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
function getPrimes(n) { | |
if (n <= 1) { | |
return "O inteiro n deve ser maior do que 1."; | |
} | |
const primes = []; | |
for (let num = 2; num <= n; num++) { | |
let isPrime = true; |
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
function recursiveFib(n) { | |
if (n < 0) { | |
return "O número deve ser maior ou igual a zero"; | |
} | |
if (n === 0 || n === 1) { | |
return n; | |
} | |
return recursiveFib(n - 1) + recursiveFib(n - 2); | |
} |
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
function linearFib(n) { | |
if (n < 0) { | |
return "O número deve ser maior ou igual a zero"; | |
} | |
if (n === 0) { | |
return 0; | |
} | |
if (n === 1 || n === 2) { | |
return 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
function linearFib(n) { | |
if (n < 0) { | |
return "O número deve ser maior ou igual a zero"; | |
} | |
if (n === 0) { | |
return 0; | |
} | |
if (n === 1 || n === 2) { | |
return 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
import java.util.ArrayList; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.Scanner; | |
public class App { | |
public static void main(String[] args) { | |
Scanner sc = new Scanner(System.in); | |
System.out.println("Digite os itens da primeira lista, separados por vírgula: "); |
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
import java.util.Scanner; | |
public class App { | |
public static void main(String[] args) { | |
Scanner inputNumber = new Scanner(System.in); | |
System.out.println("Enter a number"); | |
final int number = inputNumber.nextInt(); | |
inputNumber.close(); | |
for (int i = 1; i <= number; i++) { | |
String pyramidRow = ""; |
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
import java.util.Scanner; | |
public class App { | |
public static void main(String[] args) { | |
Scanner inputNumber = new Scanner(System.in); | |
System.out.println("Enter number"); | |
final int number = inputNumber.nextInt(); | |
inputNumber.close(); | |
System.out.println("Tabela de multiplicação de " + number); |
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
-- Questão 01: | |
SELECT COUNT("endDate") AS "currentExperiences" FROM experiences; | |
-- Questão 02: | |
SELECT "userId" AS id, COUNT(*) AS educations FROM educations GROUP BY "userId"; | |
-- Questão 03: | |
SELECT "writerId" AS writer, COUNT("writerId") AS "testimonialCount" FROM testimonials | |
WHERE "writerId" = 435 | |
GROUP BY "writerId"; |
NewerOlder