Instantly share code, notes, and snippets.

🏠
Working from home

# Erhan Yaşar erhanyasar

🏠
Working from home
Created July 27, 2023 11:19
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
 /* Given Brief # Find a total ordered quantity of a product for every weekday You are asked to improve the analytics of an e-commerce platform: calculating a total quantity of a given product ordered should be added. # Task Implement `OrdersAnalyzer.totalQuantity(orders, productId)` method which
Last active July 26, 2023 20:19
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
 /* Write a Function According to Given Brief: The MEX number of a non-negative set of numbers is the smallest non-negative number that is not present in the set. For example, MEX([1, 3, 10]) = 0, and MEX([0, 1, 2, 8]) = 3. Your task is to take a given array arr of length num and remove the minimum number of elements from it so that, the MEX value of the modified array is not equal to the MEX value of the original array. - It should return the minimum number of elements that needed to be removed from the array
Created July 24, 2023 14:37
A function returns depth for a given number under given conditions
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
 /* The depth of an integer n is defined to be how many multiples of n it is necessary to compute before all 10 digits have appeared at least once in some multiple. Example: let see n=42 Multiple value digits comment 42*1 42 2,4 42*2 84 8 4 existed 42*3 126 1,6 2 existed
Last active July 20, 2023 14:05
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
 // 1. Write a function for strings that return a string that's repeating the string // for a given integer number for instance, given `"hello".repeatify(3)` expression // should return "hello, hello, hello" as an output String.prototype.repeatify = function (param) { let result = ""; for (let i = 0; i < param; i++) result += `, \${this}`; return result.slice(1).trim(); };
Created June 16, 2023 16:25
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
 let numbersArr = [4, 6, 7, 9, 12]; function findSecondBiggestNumber(numbers) { numbers.sort((a, b) => a - b); return numbers[numbers.length - 2]; } // console.log(findSecondBiggestNumber(numbersArr)); let strForReverse = "Erhan";
Last active June 19, 2023 19:11
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
 const dataArr = [ "B\$u\$i\$ld", "\$t\$\$h\$e", "N\$e\$x\$t", "E\$\$ra", "\$\$o\$f\$", "S\$\$of\$t\$wa\$r\$e", "De\$\$ve\$l\$op\$me\$n\$t", ];
Last active June 15, 2020 10:03
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
 const solution = (numbers) => { let maxNumber = 0; for (let i=0; i maxNumber) maxNumber = numbers[i]; } return maxNumber;
Last active March 9, 2023 14:21
Simple Quiz Solutions
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
 const object = { '1': 30, '2': 58 }; function objectToArrConverter (obj) { if (Object.entries(obj).length === 0) return []; else { let arr = Object.entries(obj);
Last active March 9, 2023 14:11
Some Quiz Questions Solved
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
 let A = [4,12,9,5,6,1], B = [4,9,12,6]; function findMissing(A, B){ let missingElements = []; for (var i=0; i
Last active March 9, 2023 14:00
A sample integration to use related barcode applications in order to read QR data
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 tryAppStore() { setTimeout(function() { window.location = "https://appsto.re/tr/6XPCz.i"; }, 25); window.location="Barcode://scan/"; } function tryGoogleStore() { setTimeout(function() { window.location = "https://play.google.com/store/apps/details?id=com.google.zxing.client.android&hl=en";