HackerRank - Sock Merchant problem in JavaScript

  Рет қаралды 5,650

Read Write Exercise

Read Write Exercise

Күн бұрын

Пікірлер: 7
@getulionm
@getulionm 3 жыл бұрын
Thanks for the video! Great to see different ways and the reasoning. I have submitted a simpler answer and went well for all test cases. function sockMerchant(n, ar) { // sort array let sortedAr = ar.sort(); let pairs = 0; for (let i = 0; i < sortedAr.length - 1; i++){ if (sortedAr[i] == sortedAr[i+1]){ pairs++; i++; } } return pairs }
@mazthespaz1
@mazthespaz1 2 жыл бұрын
you should worry about the time complexity of the sort especially if you were looking at 2 or 3 million socks
@babyyoda8913
@babyyoda8913 2 жыл бұрын
Bro can you drop your contact
@yenngoc265
@yenngoc265 3 жыл бұрын
You try to give the video more brightness it will be great if you do
@y_thedreamer95
@y_thedreamer95 3 жыл бұрын
To fix your icons in the terminal, you just have to specify in the vs code settings that you want that font for the terminal as well, I mean the fancy font, maybe Inconsolata or whatever you have used, so that it will recognize the icons.
@avemaria4ajay
@avemaria4ajay 2 жыл бұрын
const arr = [1,2,3,1]; const s = new Set(); const res = arr.reduce((pre, curr) => { if(s.has(curr)){ s.delete(curr); return ++pre; } s.add(curr); return pre; }, 0); console.log(res)
HackerRank (JavaScript): Minimum absolute difference problem
14:14
Read Write Exercise
Рет қаралды 3 М.
JavaScript Cardio [Session 2] - LongestWord, Anagrams, Array Chunking
42:27
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН
It works #beatbox #tiktok
00:34
BeatboxJCOP
Рет қаралды 41 МЛН
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 898 М.
Can you solve this tricky JavaScript Array problem?
19:56
Wes Bos
Рет қаралды 20 М.
Front End Mock Technical Interview | JavaScript, CSS, React, and Algorithms
1:33:39
HackerRank: Sock Merchant JavaScript
10:01
James Guest
Рет қаралды 408
JavaScript Cardio [Session 3] - Add All, Sum Primes, Seek & Destroy
40:24
Why Signals Are Better Than React Hooks
16:30
Web Dev Simplified
Рет қаралды 492 М.
I tried 8 different Postgres ORMs
9:46
Beyond Fireship
Рет қаралды 440 М.
So You Think You Know Git - FOSDEM 2024
47:00
GitButler
Рет қаралды 1,3 МЛН
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН