J

@jramsa

numberToSmoke

Java
1 year ago
import java.util.*; import java.lang.*; import java.io.*; class Main { public static int numberToSmoke(int n) { int sum=0; int cpt=0; for(int i=0; i<n; i++){

countFrequencies : Nombre d'occurrences triées d'un mot dans un tableau

Java
1 year ago
import java.util.*; import java.lang.*; import java.io.*; class Main { public static int [] countFrequencies(String [] words){ ArrayList<String> wordList = new ArrayList<>(); ArrayList<Integer> frequenciesList = new ArrayList<>(); Arrays.sort(words);

get : Calcul combinatoire - Big Integer

Java
1 year ago
import java.util.*; import java.lang.*; import java.io.*; class Main { static String get(int l, int c) { if(c>l) return "0"; if(l==0 || c==0) return "1";

searchValues : ArrayIndex - Entier dans une liste à un indice pair/impair

Java
1 year ago
import java.util.*; import java.lang.*; import java.io.*; class Main { private static List<Integer> searchValues(List<Integer> numbers, int value ) { int integer_1=0; int integer_2=0; int integer_3=0; int integer_4=0;

SQL : insérer des enregistrements d'une autre table

SQL
1 year ago
-- create a table CREATE TABLE product_category ( product_category_id INTEGER PRIMARY KEY, name TEXT NOT NULL, description TEXT NOT NULL ); CREATE TABLE product ( product_id INTEGER PRIMARY KEY, product_category_id INTEGER,

SQL : Intervalles de sommation pour calculer les temps de fonctionnement sur un mois

SQL
1 year ago
--En tant que responsable de l'infrastructure de votre entreprise, vous enregistrez le temps de --fonctionnement de tous vos serveurs et équipement dans cette table : SELECT asset_id, SUM( DATEDIFF( HOUR, CASE WHEN dt_start < '2024-06-01 00:00:00' THEN '2024-06-01 00:00:00'

applyfilter : filtres d'images

Java
1 year ago
import java.util.*; import java.lang.*; import java.io.*; class Main { public static void affiche(int width,int height, int [][] color){ for(int i = 0; i<height ; i++) { for (int j = 0; j < width; j++) System.err.print(color[i][j] + " "); System.err.println();

countPaths : Browse a graph to buy school supplies for your kids

Java
1 year ago
import java.util.*; import java.lang.*; import java.io.*; class Main { private static int countPaths(List<Integer> shops, List<List<Integer>> roads) { //Build map HashMap<Integer, ArrayList<Integer>> map = new HashMap<>(); for (int i = 0; i < shops.size(); i++) map.put(i, new ArrayList<>());

countRotations : Gears Rotation direction

Java
1 year ago
import java.util.*; import java.lang.*; import java.io.*; class Main { public static List<Integer> countRotations(int nCogWheels, List<List<Integer>> connections){ HashMap<Integer,String> map = new HashMap<>(); System.err.println("Ajout Wheel 0"); map.put(0,"clockwise"); for(List<Integer> wheelList : connections){

isOnEvenPosition : return Array index of value

Java
1 year ago
import java.util.*; import java.lang.*; import java.io.*; class Main { public static boolean isOnEvenPosition(List<Integer> numbers, int value){ if(numbers.isEmpty()) return false; else{ if(!numbers.contains(value))

findSumPair

Java
1 year ago
import java.util.*; import java.lang.*; import java.io.*; class Main { public static List<Integer> findSumPair(List<Integer> numbers, int k) { int ind1=0; int ind2=0; for(int i=ind1; i<numbers.size(); i++){ for(int j=i+1; j<numbers.size(); j++){

filterDuplicates : tableau sans nombres dupliqués

Java
1 year ago
import java.util.*; import java.lang.*; import java.io.*; class Main { public static int [] filterDuplicates(int [] data){ ArrayList<Integer> integerList = new ArrayList<>(); for(int i=0; i<data.length; i++){ if(!integerList.contains(data[i])) integerList.add(data[i]);

computeCheckSums

Java
1 year ago
import java.util.*; import java.lang.*; import java.io.*; class Main { public static List<Integer> computeCheckSums(List<Integer> filebytes){ ArrayList<Integer> computeList = new ArrayList<>(); int subSize=0; for(int j=0; j<filebytes.size();j=j+filebytes.get(j)+1){

computeJoinPoint : sequences de nombre se rejoignant

Java
1 year ago
import java.util.*; import java.lang.*; import java.io.*; class Main { public static int computeJoinPoint(int s1, int s2){ while (s1!=s2){ System.err.println("valeur de s1: " + s1); System.err.println("valeur de s2: " + s2);

reshape : String formatée

Java
1 year ago
import java.util.*; import java.lang.*; import java.io.*; class Main { public static String reshape(int n, String str){ if(str==null){ return null; } StringBuilder reshapeString = new StringBuilder();

SQL : Data transformation

MySQL
1 year ago
-- create a table CREATE TABLE employees ( id INTEGER PRIMARY KEY NOT NULL, first_name TEXT NOT NULL, last_name TEXT NOT NULL, num_years INTEGER NOT NULL, satisfaction DECIMAL(25,5) NOT NULL); -- insert some values INSERT INTO employees VALUES (1,'Harry','Potter',7,0.999999);

mergeData : Merge fields : collect and sort Data

Java
1 year ago
import java.util.*; import java.lang.*; import java.io.*; class Main { public static List<String> mergeData(List<String> dataStrings) { ArrayList<String> mergedStrings = new ArrayList<>(); HashMap<String, String> map = new HashMap<>(); Map<String, String> sortedMap;

checkSudoku : Check grille sudoku : ligne, colonne, region

Java
1 year ago
import java.util.*; import java.lang.*; import java.io.*; class Main { public static String checkSudoku(List<List<Integer>> sudoku){ int [] listToCheck = {1,2,3,4,5,6,7,8,9}; //gestion ligne for(int i=0; i<sudoku.size(); i++){

SQL : postal_code in supplier/location

SQL
1 year ago
-- create a table CREATE TABLE location ( location_id INTEGER PRIMARY KEY, city TEXT, state_province TEXT, postal_code TEXT(5), country TEXT); CREATE TABLE supplier ( supplier_id INTEGER PRIMARY KEY,

solve : Blocs inter-bloqués

Java
1 year ago
import java.util.*; import java.lang.*; import java.io.*; class Main { public static int solve(int width, int height, int nbBlocks, String[] grid) { int valueBlockToRemove=0; int ind=0; for(int i=1; i<height-1; i++){ char [] t = grid[i].toCharArray();