Skip to content

Instantly share code, notes, and snippets.

@isavch
Last active May 3, 2019 13:15
Show Gist options
  • Select an option

  • Save isavch/79ed396d9d3bfece14bac9f72356fb8d to your computer and use it in GitHub Desktop.

Select an option

Save isavch/79ed396d9d3bfece14bac9f72356fb8d to your computer and use it in GitHub Desktop.
1) https://leetcode.com/problems/two-sum/
sum([1, 2, 5, 3, 4], 9) -> [2, 4]
find closest sum
sum([1, 8, 5, 6, 4], 15) -> [1, 3]
2) rotateMatrix([
[1, 2],
[3, 4]
]);
Result
[
[1, 3]
[2, 4]
]
3) Implemet function pipe which works like this
const calculate = pipe(add(2), mutiply(3), divide(2))
calculate(2) -> 6
4) Implement function curry which works like this
const curriedSum = curry(sum)
curriedSum(1,2,3) -> 6
curriedSum(1, 2)(3) -> 6
curriedSum(1)(2)(3) -> 6
5) Implement
5.1) flat([1, [1, 2], 2, [[1, 3, 4]]], 2) -> [1, 1, 2, 2, [1, 3, 4]]
5.2) unique([1, 2, 3, 4, 1]) -> [1,2,3,4]
6) Promises
6.1) What is the difference between promise and setTimeout
6.2) Sequence of promises, implement function sequence(arraOfPromises) which runs them in sequence
7) What is react context and use cases
8) Problem with this.setState({showForm : !this.state.showForm}); and how to solve it
9) Write HOC exmaple, renderToProps exmaple
10) Redux middlewrare, write logging middleware
11) Write a reducer wich increments decrements value, and cover it with tests
const initialState = 0
const reducer = (state, action) => {}
describe('reducer', () => {
it('should increment')
it('should decrement')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment