找到一个跟我的思路比较接近的参考解决方案: 参考:https://leetcode.com/problems/smallest-subsequence-of-distinct-characters/discuss/308222/show-my-thinking-process ...
分类:
其他好文 时间:
2019-06-09 22:25:27
阅读次数:
136
其实这道题好像大部分人都直接用Tries倒序来解,但我觉得AC自动机可能更高效一点(毕竟是在Tries基础上优化的算法如果还不如原始Tries似乎说不过去)。 根据定义写了个原始的在堆上创建树形结构的solution但好像性能并不是很乐观。另外一些用AC解的dalao好像是用一条线性结构存储所有结点 ...
分类:
其他好文 时间:
2019-06-09 14:32:44
阅读次数:
88
分类讨论的项比较多 先观察给的例子,还有题目给的提示——valid答案中可以包含的字符 发现: "+ - "要么在开头,要么紧跟着e,只有这两个位置 "e",前后必须有数字,且之前不能出现过e ". ",前面不能出现过e或". " 所以我们可以用几个flag seenNum表示之前出现过数字 see ...
分类:
其他好文 时间:
2019-06-07 10:58:38
阅读次数:
74
1.验证在获取反序列化的数据前,必须调用is_valid()方法进行验证,验证成功返回True,否则返回False。验证失败,可以通过序列化器对象的errors属性获取错误信息,返回字典,包含了字段和字段的错误。如果是非字段错误,可以通过修改REST-framework配置中的NON_FIELD_E... ...
分类:
其他好文 时间:
2019-06-06 18:52:10
阅读次数:
89
Given two binary strings, return their sum (also a binary string). The input strings are both non-empty and contains only characters 1 or 0. Example 1 ...
分类:
其他好文 时间:
2019-06-06 00:35:13
阅读次数:
101
Write a function that reverses a string. The input string is given as an array of characters char[]. Do not allocate extra space for another array, yo ...
分类:
编程语言 时间:
2019-06-05 10:05:49
阅读次数:
153
基于tf2.0 对Kaggel Google street view characters classify 项目练手, 熟悉一下tf2.0的新特性 下载下来kaggle的数据集如下: 所有训练数据在train文件夹中, labels在trainLabels.cvs文件中, label文件格式如下: ...
分类:
其他好文 时间:
2019-06-04 22:21:53
阅读次数:
352
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the last word ...
分类:
其他好文 时间:
2019-06-04 11:24:41
阅读次数:
100
The statements that describe valid input are known as preconditions and the conditions that the output should satisfy when the program has run are kno ...
分类:
移动开发 时间:
2019-06-02 21:50:15
阅读次数:
152
Linux / Cent OS 服务器不能用yum安装软件? 总是提示“cannot find a valid baseurl or repo...”? 这篇说不定能解决你的问题?? ...
分类:
Web程序 时间:
2019-06-02 17:39:34
阅读次数:
151