Skip to content

Instantly share code, notes, and snippets.

const NumericSequencer = () => {
let userInput = prompt();
let currMax = userInput;
let occurrences = 0;
while (userInput != 0) {
if (userInput > currMax) {
currMax = userInput;
occurrences = 1;
} else if (userInput == currMax) {
const digitSummer = (input) => {
if (input < 10 || input === 0) return input;
return (input % 10) + digitSummer(Math.floor(input / 10));
};
@Tamir198
Tamir198 / priceCheck.js
Created January 18, 2023 22:09
Price Check
const priceCheck = (products, productPrices, productSold, soldPrice) => {
let incorrectSales = 0;
productSold.forEach((product, index) => {
if (soldPrice[index] !== productPrices[products.indexOf(product, index)]) {
incorrectSales++;
}
});
return incorrectSales;
/* main.c */
#include <stdio.h>
#include <sdtlib.h>
int main(int argc, char *argv[]) {
pid_t pid;
if( (pid = fork() ) < 0){
printf("Fork error");
}else{
function longestSuset(array) {
let arrLen = array.length;
let maxSubsetCount = new Array(arrLen).fill(1);
for (i = 1; i < arrLen; i++) {
for (j = 0; j < i; j++) {
if (array[i] > array[j] && maxSubsetCount[i] <= maxSubsetCount[j]) {
maxSubsetCount[i] = maxSubsetCount[j] + 1;
}
}
/*exe 1 turn time in seconds to H:M:S format
int totalTime;
printf("Enter time in seconds \n \n \n");
scanf("%d", &totalTime);
int hours = totalTime / 3600;
totalTime = totalTime - hours*3600;
int minuts = totalTime % 60;
totalTime = totalTime - minuts*60;
int secs = totalTime ;