1. 题一: Merge the Tools. 给出一个string, 和整数k。 把string等分成k个substring, (string长度是k的倍数), 输出每个substring但substring里字母不重复。
example: 'HOWAREUUU' 输出: ‘HOW', 'ARE', 'U'。
思路,先用string index的方法分成substrings, 储存为list。对每个substring,生成一个空string l,把已有的字母储存进去,如果不在其中的话。 最后输出
2. 题二: Time Delta. 给出n组,每组两个时间,输出每组时间的差别,用秒表达。要求输入的时间格式是 Day dd Mon yyyy hh:mm:ss +xxxx.
Example:
思路,import datetime,使用datetime的strptime 方法,先创建f='%a .... %来表示时间的格式,随后用total_seconds()method 来计算秒差别。