Sock Merchant Hacker Rank Javascript Solutions

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

Ady Ngom

Ady Ngom

Күн бұрын

Пікірлер: 7
@alexandramedina5498
@alexandramedina5498 4 жыл бұрын
The first part worked for me! And to each their own right? Because I totally understood the first solution but got lost in the 2nd solution. Thanks for sharing!
@AdyNgom
@AdyNgom 4 жыл бұрын
Glad it was helpful Alexandra. Cheers
@rodmm3010
@rodmm3010 4 жыл бұрын
they target different problems. first one just build up pairs.second one actually build groups.
@aslancanylmaz7294
@aslancanylmaz7294 4 жыл бұрын
there is an app that has hackerrank's all javascript solutions, and u can copy the code. "Hackerrank JS"
@fahadzakir6397
@fahadzakir6397 5 жыл бұрын
The first solution did not pass all the hacker rank test, and the 2nd one did. The first solution was a lot easier to understand than the 2nd solution I did not understand the bottom part with n in it.
@rashad123us
@rashad123us 5 жыл бұрын
It takes the the values from the dictionary he built using the reduce array method, divides them in half then rounds down using parseint. So you only add the colors with 1 or more pairs to the pairs count. Its pretty simple, and more efficient.
@rodmm3010
@rodmm3010 4 жыл бұрын
Second solution is correct and nice. with the use of keys and works in every scenario. first solution not right. Will not work with constraints. Not a valid solution for hackerrank test. Also it just put pairs toghether. it is not creating differentarrays or objects with all the equal values. Just puts pairs together not arrays of same value items. Example if you had an array like let arr= [1,1,1,1] It will make 2 pairs of [1,1] instead of grouping all of them into one array. Why would i want to have 2 arrays of [1,1]??
HackerRank - Sock Merchant problem in JavaScript
10:50
Read Write Exercise
Рет қаралды 6 М.
Dependency Injection, The Best Pattern
13:16
CodeAesthetic
Рет қаралды 898 М.
小丑教训坏蛋 #小丑 #天使 #shorts
00:49
好人小丑
Рет қаралды 52 МЛН
СИНИЙ ИНЕЙ УЖЕ ВЫШЕЛ!❄️
01:01
DO$HIK
Рет қаралды 3,2 МЛН
5 JavaScript Concepts You HAVE TO KNOW
9:38
James Q Quick
Рет қаралды 1,4 МЛН
Microservices are Technical Debt
31:59
NeetCodeIO
Рет қаралды 686 М.
How Senior Programmers ACTUALLY Write Code
13:37
Thriving Technologist
Рет қаралды 1,6 МЛН
My 10 “Clean” Code Principles (Start These Now)
15:12
Conner Ardman
Рет қаралды 303 М.
Was I Wrong About Blazor? | Coding Shorts 111
16:35
Shawn Wildermuth
Рет қаралды 27 М.
USA strikes Russia / Zelensky's statement on negotiations
15:12
NEXTA Live
Рет қаралды 294 М.
How to write and publish your first Typescript library
14:16
Ady Ngom
Рет қаралды 13 М.
Git Tutorial For Dummies
19:25
Nick White
Рет қаралды 1,2 МЛН
Now I Know Why Most People Don’t Use gRPC
19:11
ArjanCodes
Рет қаралды 59 М.
I tried 8 different Postgres ORMs
9:46
Beyond Fireship
Рет қаралды 440 М.