let index = 0; let stack = []; function next() { let fn = stack[index]; index++; if(typeof fn === 'function'){ fn(); } } function fn1() { console.log(... ...
分类:
其他好文 时间:
2018-10-09 00:42:00
阅读次数:
623
Given an array of strings, group anagrams together. Example: Input: ["eat", "tea", "tan", "ate", "nat", "bat"], Output: [ ["ate","eat","tea"], ["nat", ...
分类:
其他好文 时间:
2018-10-08 13:29:08
阅读次数:
142
#include<iostream.h>//定义一个动物类class Animal{public: void eat();//添加方法 { cout<<"animal eat"<<endl; } void sleep();//添加方法 { cout<<"animal sleep"<<endl; } ...
分类:
编程语言 时间:
2018-10-01 21:42:18
阅读次数:
181
1 # 不同类中self的传递 2 3 class Foo(object): 4 def __init__(self, config): # config是Cat中的self 5 self.config = config 6 7 def eat(self): 8 print(self.config.... ...
分类:
其他好文 时间:
2018-10-01 11:56:24
阅读次数:
139
import abc
class Animal(metaclass=abc.ABCMeta):
@abc.abstractmethod #强制子类
def eat(self):
pass
@abc.abstractmethod
def run(self):
pass
class Peeple(Animal):
def eat(self):
print(‘peeple is eating‘)
def run(self):
print(‘peeple is runing‘)
class Dag(Animal):
def eat(self):
print(‘dag is eating‘)
def run(self):
print(‘dag is runing‘)
peo1=Peeple()
dag1=Dag()
peo1.eat()
dag1.eat()
分类:
其他好文 时间:
2018-09-25 22:55:54
阅读次数:
182
49. Group Anagrams Given an array of strings, group anagrams together. Example: Input: ["eat", "tea", "tan", "ate", "nat", "bat"], Output: [ ["ate","e ...
分类:
其他好文 时间:
2018-09-17 21:29:05
阅读次数:
205
God Water likes to eat meat, fish and chocolate very much, but unfortunately, the doctor tells him that some sequence of eating will make them poisono ...
分类:
其他好文 时间:
2018-09-17 11:45:18
阅读次数:
307
题目链接:https://nanti.jisuanke.com/t/31714 题意:给你一棵树,初始全为0,有四种操作: 1.u-v乘x 2.u-v加x 3. u-v取反 4.询问u-v的和 思路: 除去第三个操作就是很简单的树链剖分+线段树多重标记下放,所以我们只要考虑怎么维护第三个操作就好了, ...
分类:
其他好文 时间:
2018-09-15 23:25:49
阅读次数:
240
分析 除了树剖没想到其他解法。 用线段树维护区间和,同时针对修改区间修改操作建立两个lazy标记,一个是$lazy_{mul}$,另一个是$lazy_{add}$,代表区间里的数都需要先乘以$lazy_{mul}$,再加上$lazy_{add}$。如果一个区间需要被重复标记,那么我们可以先把新的la ...
分类:
其他好文 时间:
2018-09-15 21:19:04
阅读次数:
168
God Water likes to eat meat, fish and chocolate very much, but unfortunately, the doctor tells him that some sequence of eating will make them poisono ...
分类:
其他好文 时间:
2018-09-15 20:08:10
阅读次数:
239