把所有贪心策略都想出来,然后运算,选一个最好的,而不需要证明
1 | function element(name,prop,children){ |
element(‘ul’, {id: ‘list’}, [
element(‘li’, {class: ‘item’}, [‘Item 1’]),
element(‘li’, {class: ‘item’}, [‘Item 2’]),
element(‘li’, {class: ‘item’}, [‘Item 3’])
])
1 | function element(name,prop,children){ |
element(‘ul’, {id: ‘list’}, [
element(‘li’, {class: ‘item’}, [‘Item 1’]),
element(‘li’, {class: ‘item’}, [‘Item 2’]),
element(‘li’, {class: ‘item’}, [‘Item 3’])
])