Here are some good tasks that I have met on the Internet or in interviews. For a long time, I didn't create a repository to collect such tasks and show my solutions. Some of the tasks are already exist on Codewars or Leetcode, here is my own selection of tasks.
All tasks divided by subjective level of complexity from 1 to 10
Task | Description | Level of complexity |
---|---|---|
maximalSquare | You have a 2D binary matrix that's filled with 0 s and 1 s. In the matrix, find the largest square that contains only 1 s and return its area. |
5 |
firstDuplicate | Given an array a that contains only numbers in the range from 1 to a.length, find the first duplicate number for which the second occurrence has the minimal index. | 2 |
findDeadlock | Write a function that returns True if connections describes a graph with a directed cycle, or False otherwise. | 6 |
findRepeatedDNASequences | Write a function to find all the 10-letter sequences (substrings) that occur more than once in a DNA molecule s , and return them in lexicographical order. These sequences can overlap. |
4 |
groupingDishes | Return an array where each element is a list beginning with the ingredient name, followed by the names of all the dishes that contain this ingredient. The dishes inside each list should be sorted lexicographically, and the result array should be sorted lexicographically by the names of the ingredients. | 4 |
Platforms:
Books:
Node and npm are required to continue setup.
Note: The best alternative npm is yarn. I use yarn because yarn supoorts workspaces, which i use in most of my projects.
First step
Execute in console yarn
or npm install
Run tests
Default mode: Execute in console yarn test
or npm run test
Watch mode: Execute in console yarn test:watch
or npm run test:watch
My solutions do not claim to be perfect implementation. I will be glad if you give your opinion on the best solution or add your interesting task(s)