Hackerrank-JavaScript-Solutions icon indicating copy to clipboard operation
Hackerrank-JavaScript-Solutions copied to clipboard

Solved entire Easy, few Medium Problems. A total of 171/563 challenges solved by JavaScript

Results 7 Hackerrank-JavaScript-Solutions issues
Sort by recently updated
recently updated
newest added

https://github.com/leonardomso/33-js-concepts

Functional Programming Concepts

[{"_id":"636031e7cecf4e081a25caff","body":"1. Currying - https:\/\/javascript.info\/currying-partials","issue_id":1661980399660,"origin_id":733907875,"user_origin_id":3902309,"create_time":1606332620,"update_time":1606332620,"id":1667248615793,"updated_at":"2022-10-31T20:36:55.792000Z","created_at":"2022-10-31T20:36:55.792000Z"}] comment

1. **this** 2. **immutable** data objects using a linter 3. **immutable** objects and **collections** 4. data transformations using core operations like **filter, map, sort, or reduce** 5. use statements like...

algorithm
fp

bst in js

[{"_id":"636035d83056137e266374b4","body":"https:\/\/repl.it\/repls\/FairFaroffMedian","issue_id":1661980399663,"origin_id":681030087,"user_origin_id":3902309,"create_time":1598464252,"update_time":1598464252,"id":1667249624526,"updated_at":"2022-10-31T20:53:44.526000Z","created_at":"2022-10-31T20:53:44.526000Z"}] comment

```js let node = (data) => ({ left: null, right: null, data: data }) let bst = { root: null, insert: (root = bst.root, data) => { if (root ===...

tree
graph
bst

construct the array

[{"_id":"6360324eea01ec786e810648","body":"https:\/\/gist.github.com\/axelpale\/3118596\r\nk combinations\r\n```js\r\nconst k_combinations = (set, k) => {\r\n if (k > set.length || k <= 0) {\r\n return []\r\n }\r\n \r\n if (k == set.length) {\r\n return [set]\r\n }\r\n \r\n if (k == 1) {\r\n return set.reduce((acc, cur) => [...acc, [cur]], [])\r\n }\r\n \r\n let combs = [], tail_combs = []\r\n \r\n for (let i = 0; i <= set.length - k + 1; i++) {\r\n tail_combs = k_combinations(set.slice(i + 1), k - 1)\r\n for (let j = 0; j < tail_combs.length; j++) {\r\n combs.push([set[i], ...tail_combs[j]])\r\n }\r\n }\r\n \r\n return combs\r\n}\r\n```","issue_id":1661980399667,"origin_id":668805564,"user_origin_id":3902309,"create_time":1596572467,"update_time":1596572467,"id":1667248718901,"updated_at":"2022-10-31T20:38:38.900000Z","created_at":"2022-10-31T20:38:38.900000Z"}] comment

https://www.hackerrank.com/challenges/construct-the-array/problem

dynamic
algorithm
conditional

High Value Palindrome

[{"_id":"63603bfd3056137e2663789f","body":"js solution\r\n```js\r\nfunction highestValuePalindrome(s, n, k) {\r\n let lives = k;\r\n let mod = new Array(n).fill(false);\r\n let temp = s.split('');\r\n for (let i = 0; i < n \/ 2; i++) {\r\n let j = n - i - 1;\r\n if (temp[i] != temp[j]) {\r\n mod[i] = true;\r\n lives--;\r\n }\r\n if (temp[i] < temp[j])\r\n temp[i] = temp[j];\r\n else if (temp[i] > temp[j])\r\n temp[j] = temp[i];\r\n if (lives < 0)\r\n return \"-1\";\r\n }\r\n let j = 0;\r\n while ((lives > 0) && (j < n \/ 2)) {\r\n if (temp[j] != '9') {\r\n if (mod[j])\r\n lives++;\r\n if (lives > 1) {\r\n temp[j] = '9';\r\n temp[n - j - 1] = '9';\r\n lives -= 2;\r\n }\r\n }\r\n j++;\r\n }\r\n if (n % 2 == 1) {\r\n if (lives > 0)\r\n temp[Math.floor(n \/ 2)] = '9';\r\n }\r\n return temp.join('');\r\n}\r\n```","issue_id":1661980399670,"origin_id":666366146,"user_origin_id":3902309,"create_time":1596115875,"update_time":1596115897,"id":1667251197182,"updated_at":"2022-10-31T21:19:57.181000Z","created_at":"2022-10-31T21:19:57.181000Z"}] comment

Algo ```cpp #include using namespace std; string richieRich(string s, int n, int k){ int lives=k; vector mod(n,false); string temp(s); for (int i=0;i0) temp[n/2]='9';} return temp; } int main() { int...

greedy
lives

Need more focus on Dynamic Programming

memoziation
recursion
hashing

Maximum Palindromes

[{"_id":"63602b95cecf4e081a25c6ba","body":"1. A billion and 7 is prime. \r\n2. Basic modular arithmetic \r\n3. Fermat\u2019s little theorem \r\n4. Exponentiation by squaring \r\n5. Precomputing tricks","issue_id":1661980399676,"origin_id":666607980,"user_origin_id":3902309,"create_time":1596136012,"update_time":1596136012,"id":1667246997233,"updated_at":"2022-10-31T20:09:57.233000Z","created_at":"2022-10-31T20:09:57.233000Z"}] comment

Algorithms to solve it, 1. Modular multiplicative inverse 2. Combinatorics and Permutation

fermat
modular
exponent
prime
memoziation