Given the following array, [6, 2, 3, 8]
find the minimum number of entries needed to make the array consecutive
[2, 3, *4*, *5*, 6, *7*, 8]
= 3 entries needed.
Test cases
makeConsecutive([0, 2]) === 2
import React from 'react'; | |
import useStore from './useStore'; | |
import Todo from './Todo' | |
import { todoActions } from './actions'; | |
export default () => { | |
const [ | |
todos, | |
{ addTodo, rmTodo } | |
] = useStore(store => store.todos, todoActions) |
import Component from './toy-react' | |
import { div, img } from './toy-jsx' | |
class Nested extends Component { | |
render () { | |
const { src, style } = this.props; | |
return img({ src, style }) | |
} | |
} |