#dsa
Read more stories on Hashnode
Articles with this tag
These 50 questions, would help you to master Dynamic Programming. Longest Common SubsequenceLongest Common SubsequenceLongest Common Substring...
Here's an implementation of Merge Sort in JavaScript with detailed comments to help explain each step: javascriptCopy codefunction mergeSort(arr) { ...
Input: prices = [7,1,5,3,6,4] Output: 5 Explanation: Buy on day 2 (price = 1) and sell on day 5 (price = 6), profit = 6-1 = 5. Note that buying on day...
Nested loop revision : let arr = [1, 2, 3, 4, 5, 6, 7, 8, 9] function findPairs(arr) { for (let i = 0; i <= arr.length; i++) { for (let j...
Here's a basic example of a linked list in JavaScript, with explanations at each step: kotlinCopy code// Define the Node class to represent each node...
const nums = [2, 7, 11, 15]; const target = 9; const twoSum = function(nums, target) { const hashTable = {}; //created a hashtable for (let i =...