Library Date : Link
Doc : Link
Scanner :
import java.util.Scanner;
function chunkArrayInGroups(arr, size) { | |
var newArray = []; | |
for (let i = 0; i<arr.length; i++) { | |
// console.log(i) | |
if (i == 0) { | |
newArray.push(arr.slice(i, size )) | |
}else if (i % size == 0 && i != 0) { | |
// console.log('HEY!') | |
// console.log(arr[i]) | |
// console.log(arr.indexOf(arr[i])) |
function getIndexToIns(arr, num) { | |
let result; | |
if (arr.indexOf(num) == -1) { | |
let N = Math.min(...arr.filter(e => e > num)); | |
console.log(N); | |
N = arr.indexOf(N) | |
console.log(N) | |
result = N; | |
// console.log(arr.indexOf(r)) | |
}else { |
// tabs is an array of titles of each site open within the window | |
var Window = function(tabs) { | |
this.tabs = tabs; // We keep a record of the array inside the object | |
}; | |
// When you join two windows into one window | |
Window.prototype.join = function (otherWindow) { | |
console.log(this.tabs) | |
this.tabs = this.tabs.concat(otherWindow.tabs); | |
return this; |
// tabs is an array of titles of each site open within the window | |
var Window = function(tabs) { | |
this.tabs = tabs; // We keep a record of the array inside the object | |
}; | |
// When you join two windows into one window | |
Window.prototype.join = function (otherWindow) { | |
this.tabs = this.tabs.concat(otherWindow.tabs); | |
return this; | |
}; |
// The global variable | |
var watchList = [ | |
{ | |
"Title": "Inception", | |
"Year": "2010", | |
"Rated": "PG-13", | |
"Released": "16 Jul 2010", | |
"Runtime": "148 min", | |
"Genre": "Action, Adventure, Crime", | |
"Director": "Christopher Nolan", |
const squareList = (arr) => { | |
// Only change code below this line | |
if (Array.isArray(arr)) { // check if the arr is an arrat | |
console.log('hello world') | |
arr = arr.filter(element => typeof parseInt(element) == 'number') | |
.filter(element => element > 0 && element.toString().indexOf('.') == -1) | |
.map(element => element ** 2); | |
console.log(arr) | |
return arr; | |
}else |
const INCREMENT = 'INCREMENT', // Define a constant for increment action types | |
DECREMENT = 'DECREMENT', // Define a constant for decrement action types | |
MULTIPLY = 'MULTIPLY', | |
DIVIDE = 'DIVIDE'; | |
const counterReducer = (state= 0, action) => { | |
switch(action.type) { | |
case INCREMENT : | |
return state + 1 |
'use strict'; | |
const fs = require('fs'); | |
process.stdin.resume(); | |
process.stdin.setEncoding('utf-8'); | |
let inputString = ''; | |
let currentLine = 0; |
#include <iostream> | |
#include <stdlib.h> | |
using namespace std; | |
// g++ bmi.cpp -o bmi && ./bmi | |
int main() | |
{ | |
// bmi = weight / height ** 2 |