Javascript

Index and Search (2021 Kakao Blind Recruitment)

Koowoy
Task https://programmers.co.kr/learn/courses/30/lessons/72412; My Solution referenced from: https://velog.io/@alvin/%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%A8%B8%EC%8A%A4-%EB%AC%B8%EC%A0%9C%ED%92%80%EC%9D%B4-%EC%88%9C%EC%9C%84-%EA%B2%80%EC%83%89-Javascript https://12bme.tistory.com/120 function solution(info, query) { let answer = []; // store every possible combination that every info can match to let combinations = {}; const getCombinations = (arr, score, init) => { let spec = arr.join(''); let value = combinations[spec]; // add score to combination object if (value) { combinations[spec].push(score); } else { combinations[spec] = [score]; } // recursive function, to loop through every possibility for (let i = init; i < arr.

[Javascript Regex] Recommending Alternative ID

Koowoy
Task Requirements The Rules for the ID Length of the ID must be 3 to 15 characters. Only alphanumeric(lowercase) characters and [ -] , [ _ ], [ . ] are allowed. [ . ] can not be used at the beginning and the end, and cannot be used consecutively. Seven Steps in Creating Recommended ID Step 1. Change all the uppercase letters to lowercase.

Identifying the Loser from a Game of Word Chain

Koowoy
Rule of the Game Certain number of players present a word in turns, that begins with the letter of the last word’s ending. For instance, if the last word was apple, the current player needs to present a word that starts with e. No word can be presented twice in the same game. Therefore the loser is a. whose word presented didn't begin with the last word's ending(let's call this following the previous word) or b.

Enlightenment of the Day 21.01.21

Koowoy
Getting Student with Highest Score Problem 3 Students are taking a multiple choice test with 5 answer options. Without actually solving the problem, they repeat the same pattern of numbers. When fed with the answer array, return the student who scored the highest. Requirements 1. The pattern of each student is as follows: Student 1: 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2 .... Student 2: 2, 1, 2, 3, 2, 4, 2, 5, 2, 1, 2, 3 .

Enlightenment of the Day 21.01.11

Koowoy
Situation Solving the following task on Programmers (Link) Task An interger array ‘numbers’ is given. Create a function that returns an array consisting of sums of 2 numbers of different index sorted in an ascending order. Resitrictions The length of ‘numbers’ is between 2 to 100. All of the numbers of are bewtween 0 to 100. Input/Output example numbers result [2, 1, 3, 4, 1] [2, 3, 4, 5, 6, 7] [5, 0, 2, 7] [2, 5, 7, 9, 12] My Approach to the Solution Initially Logic Sort the input array in ascending order => loop through the array using forEach => in each iteration, map the array, adding the current value to the array => add all that to a result array => using Set, pick out unique values