Contains Leetcode and Hacker Rank questions and answers.
To test locally, make sure you have Node.js installed
For example to run the solution for sorting problem, run node javascript/sortList.js
to test the solution for the sorting problem.
To run from the file with all the solution, for example to run sortList
solution , use the following command:
node --eval "require('./javascript/arrays.js').sortList()"
-
Remove Duplicates from Sorted Array sort-list.js Given a sorted array nums, remove the duplicates in-place such that each element appears only once and returns the new length. (Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory.)
-
Write a code that can convert intergers to Roman numerals (20 min) I = 1, X= 10, IX= 9, XI= 11, L =50, C= 100, D= 500, M= 1000
-
The mall management is trying to figure out what was the busiest moment in the mall in the last year. Each data entry includes a timestamp (seconds in Unix Epoch format), an amount of people and whether they entered or exited. reference
-
Find the number!Given an unsorted array of n elements, find if the element k is present in the array or not.Complete the findNumber function in the editor below. It has 2 parameters:An array of integers, arr, denoting the elements in the array.An integer, k, denoting the element to be searched in the array.The function must return a string "YES" or "NO" denoting if the element is present in the array or not.