Remove cruft from day 4
This commit is contained in:
parent
0799312f03
commit
ea618c546e
25
04/code.js
25
04/code.js
|
@ -40,28 +40,3 @@ for (i in inputArray) {
|
|||
|
||||
console.log(totalCount);
|
||||
|
||||
// functions
|
||||
|
||||
function getBadge(arrs) {
|
||||
let badge = arrs[0];
|
||||
for(let i = 1; i < arrs.length; i++){
|
||||
badge = intersection(badge, arrs[i]);
|
||||
};
|
||||
return badge[0];
|
||||
}
|
||||
|
||||
function getIntersection(contents) {
|
||||
const length = contents.length;
|
||||
const first = contents.substring(0, length / 2).split("");
|
||||
const second = contents.substring(length / 2).split("");
|
||||
return intersection(first, second)[0];
|
||||
}
|
||||
|
||||
function getPriority(char) {
|
||||
const characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
return characters.indexOf(char) + 1;
|
||||
}
|
||||
|
||||
function intersection(first, second) {
|
||||
return first.filter(x => second.includes(x));
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user