JS

Sidenote_21.07.29

Koowoy
Steps to try when pip doesn’t work properly Run in Administrative Mode Reinstall pip with py -m ensurepip --upgrade (pip documentation) Alternative command when django-admin doesn’t work From Django Docs command not found: django-admin¶ django-admin should be on your system path if you installed Django via pip. If it’s not in your path, ensure you have your virtual environment activated and you can try running the equivalent command python -m django.

[Sidenote/JS] Using Stack for Maximum Efficiency

Koowoy
Solution Reference: https://programmers.co.kr/questions/17409 Task https://programmers.co.kr/learn/courses/30/lessons/12973 Given a string of characters, if two of the same alphabet in a row is to be deleted until there is none left, check if this possible with the given string. Solution function solution(s) { // Split string into array let arr = s.split(''); // Set temporary stack array let temp = []; // If string length is odd number, return 0 if (arr.

[JS/Problem Solving] Get Target Number

Koowoy
Task https://programmers.co.kr/learn/courses/30/lessons/43165 Count how many combinations of adding and subtracting each element of the given array results the given target number. Solution function solution(numbers, target) { let answer = 0; let nums = [...numbers]; const tar = target; // Recursive function const getTarget = (arr, num, count) => { // Get sum at every loop let sum = arr.reduce((a, c) => a + c, 0); // If sum matches target, increase answer if(sum === num) { answer++; } // For every item in array, change to negative value, recursion for (let i = count; i < arr.

[JS/Problem Solving] Getting the highest possible number

Koowoy
Task Requirements A number between 0 and 1,000,000 and k that is smaller than the first number is given. When k amount of digit is removed, return the highest possible number. My Attemps for Solution No.1) Using Combination On first thought, I wasn’t aware of how big the number could be, and came up with the idea to find all possiblities and to compare these to find the maximum value.

[Sidenote/JS] Using Recursion to Get All Possible Combinations

Koowoy
The definition of combination in mathematics is as follows: In mathematics, a combination is a selection of items from a collection, such that the order of selection does not matter. (from Wikipedia) In order to get all the possible selections, the following formula is used: image-source The first part refers to all the combination that includes a certain value, and the latter part refers to all the combinations that does not include that value.