Programming › Re: AOC 2024 by Deicide(op): 6:54am On Dec 01, 2024*. Modified: 3:14pm On Dec 03, 2024 |
Day 1: Historian Hysteria export const part1 = async () => { const input = await fileReader("https://adventofcode.com/2024/day/1/input"); const rightBox: number[] = []; const leftBox: number[] = []; input.split("\n" ).forEach((line) => { const [left, right] = line.split(/\s+/); leftBox.push(Number(left)); rightBox.push(Number(right)); }); leftBox.sort((a, b) => a - b); rightBox.sort((a, b) => a - b); const ans = rightBox.reduce( (acc, curr, index) => curr > leftBox[index] ? acc + curr - leftBox[index] : acc + leftBox[index] - curr, 0, ); console.log(ans); };
export const part2 = async () => { const input = await fileReader("https://adventofcode.com/2024/day/1/input"); const rightBox: number[] = []; const leftBox: number[] = []; input.split("\n" ).forEach((line) => { const [left, right] = line.split(/\s+/); leftBox.push(Number(left)); rightBox.push(Number(right)); }); const map = new Map<number, number>(); rightBox.forEach((item) => { if (map.has(item)) { map.set(item, map.get(item)! + 1); } else { map.set(item, 1); } }); let ans = 0; leftBox.forEach((item) => { if (map.has(item)) { ans += map.get(item)! * item; } }); console.log(ans); };
|
Programming › AOC 2024 by Deicide(op): 5:57am On Dec 01, 2024 |
I go respect myself this time around use typescript + Bun. |
Nairaland General › Re: Linkedin Verification In 1,2,3... by Deicide: 8:38pm On Nov 30, 2024 |
So person no fit use National ID |
Programming › Re: Voice Authentication In Nodejs by Deicide: 8:54am On Nov 29, 2024 |
Using require in 2024 is wild o |
Phone/Internet Market › Re: BUY UR ORIGINAL XIAOMI,ROMOSS POWER BANKS, WIRELESS SPEAKERS, MOBILE ACCESSORIES by Deicide: 12:48pm On Nov 27, 2024 |
How much for 30000Mah Romos? |
Phones › Re: I Just Got A New Romoss Product. Any Tips? by Deicide: 8:09am On Nov 27, 2024 |
Why is it more expensive on AliExpress |
Phones › Re: How Good Is Romoss Powerbanks? by Deicide: 7:59am On Nov 27, 2024 |
|
Romance › Re: What Else Will A Guy Gain From A Girl That Says "No Sex" In The Relationship? by Deicide: 9:50am On Nov 26, 2024 |
Me i don't even care about sex, na breast I wan press  |
Fashion › Re: What Do You Think About Women Wearing Leg Chain? by Deicide: 6:22pm On Nov 25, 2024 |
Puss360: Lol, my auntie's daughter wears leg chain, nose ring, even has tattoo on her breast.. lol... And guess what, she is a professional Paediatric specialist... With outstanding medical qualifications... doesn't mean she's not an Olosho, if you know you know |
Family › Re: Please We Are Looking For This Girl by Deicide: 6:20pm On Nov 20, 2024 |
Ogun Ah. Just forget about it |
Romance › Re: Why Are So People Wicked And Heartless by Deicide: 10:01am On Nov 20, 2024 |
So you were doing all this so he can care about you. Why are you gay? |
Phones › Re: LG Users???? Get In Here!!!! by Deicide: 11:39pm On Nov 18, 2024 |
Lol, nope. skywolf28: Experienced the charging port problem yet? |
Phones › Re: LG Users???? Get In Here!!!! by Deicide: 9:25pm On Nov 18, 2024 |
Listening to music on this v60 day burst my head  |
Travel › Re: Nigerian Lady Denied US Visa, Nigerians Demand Refund Policy. by Deicide: 8:57am On Nov 11, 2024 |
How much does it actually cost?. Make i know to pity them or not. |
Business › Re: Upwork Thread (Questions/Help/Advice) by Deicide: 8:52am On Nov 11, 2024 |
 Bold of you to assume that i get Jobs Adebaba1: How do you get jobs |
Programming › Re: Please Recommend A Good Laptop by Deicide: 10:49pm On Nov 09, 2024 |
Please, learn how to read and comprehend. sexyteeola: How techie are you not to know latest AMD processors are better than intel... Go and check all most gaming laptops they come with AMD Ryzen. |
Business › Re: Upwork Thread (Questions/Help/Advice) by Deicide: 3:12pm On Nov 08, 2024 |
I hardly even open that app again  qtguru: Yes but Upwork has changed, it's hard getting gigs, so now I'm focusing on cold mailing |
Health › Re: Please Help My Eye Sight by Deicide: 11:12am On Nov 08, 2024 |
Ah so ishilove you get connection like this  Ishilove: Call him on 08059743276 and tell him Ishilove gave you his number |
Health › Re: 4 Ways To Prevent HIV by Deicide: 10:46am On Nov 08, 2024 |
What if i like it raw |
Celebrities › Re: Where Is Runtown? by Deicide: 11:45am On Oct 25, 2024 |
Na industry plant |
Phones › Re: Phone Users, Am I The Only One Experiencing This Scary Thing by Deicide: 1:37pm On Oct 24, 2024 |
Stop being willfully ignorant Growingboi: Those people saying AI this AI that should come explain to us if AI has started reading people's mind from their phone or you people didn't read what that poster wrote there? |
Computers › Re: Clean UK Used Lenovo T14s Gen 2 - 16GB RAM, SSD, Ryzen 5 Pro, Face Unlock by Deicide: 8:24am On Oct 24, 2024 |
How many of this do you have because I might order one early next year, cause Na then I go get money |
Celebrities › Re: The Uneducated Boy Don Buy Car Again- Peller Says As He Shows Off His New Car by Deicide: 6:10pm On Oct 20, 2024 |
Tiktokers day make moni o |
Phones › Re: LG Users???? Get In Here!!!! by Deicide: 10:59am On Oct 17, 2024 |
No Nigeria Network support that 5G Band Serenitys: Where did u get this lies from.. My lg v60 gets volte on airtel.. Lg losing playstore certification is a hoax.. Tmobile version gets 5g network.. |
Business › Re: EKEDC Announces Major System Upgrade For Enhanced Customer Experience by Deicide: 1:22pm On Oct 16, 2024 |
Upgrade to make your meter read faster  |
Phones › Re: LG Users???? Get In Here!!!! by Deicide: 1:11pm On Oct 14, 2024 |
Aren't this phones better than v60, especially S21 Kaveco: I have some phones in mind, but they're not really upgrades.
S21, Pixel 5. |
Phones › Re: LG Users???? Get In Here!!!! by Deicide: 11:40pm On Oct 13, 2024 |
Kaveco: LG phones will lose playstore certification by the year's end. It means some apps that require your playstore to be "certified" won't work. So you'll need to root your phone and do some tweaks to fix it. Source? And also which phone would you suggest if not the v60? |
Sports › Re: Hisbah Raids Betting Shops In Kano by Deicide: 8:57am On Oct 03, 2024 |
They can Legally do this because our constitution supports sharia Law |
Phones › Re: LG Users???? Get In Here!!!! by Deicide: 8:06pm On Oct 01, 2024 |
How much? HeavenSentGroup: If you're interested, I have a US used one with dual screen and magnetic adaptor. |
Crime › Re: Testimony John: Police Declare 18-Year-Old Girl Missing In Ogun by Deicide: 12:37pm On Oct 01, 2024 |
Since it's ogun state, she's gone RIP |
Romance › Re: If The Guy Is Not Picking Your Call... by Deicide: 8:58am On Oct 01, 2024 |
Call way day always come with biling |
Phones › Re: 9mobile Has Overtaken Glo As The Worst Network In Nigeria by Deicide: 4:41am On Oct 01, 2024 |
Glo has never been bad, na you no get band 28  |