![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
Yi白
成长型思维
展开
-
leetcode 476. Number Complement题解
Given a positive integer, output its complement number. The complement strategy is to flip the bits of its binary representation.Note: 1. The given integer is guaranteed to fit within the range of a 3原创 2017-01-21 22:32:31 · 437 阅读 · 0 评论 -
leetcode 456. 132 Pattern题解
Given a sequence of n integers a1, a2, …, an, a 132 pattern is a subsequence ai, aj, ak such that i < j < k and ai < ak < aj. Design an algorithm that takes a list of n numbers as input and checks whet转载 2017-01-21 23:17:53 · 1590 阅读 · 0 评论 -
[leetcode] Fraction to Recurring Decimal
没想到溢出这码事儿。。。纠结了好久。。。abs只能针对int所以得自己做abs。。。 需要记录循环开始的位置 #include <iostream> #include <vector> #include <string> #include <map> #include <sstream> using namespace std;string fractionToDecimal(int numerat原创 2017-05-02 20:59:04 · 217 阅读 · 0 评论 -
[leetcode]Repeated Substring Pattern顺带复习KMP
虽然是easy题型,但是想要高效的实现,还是得用KMP的思想啊。。 PS:一遇到next数组就歇菜。。原因是对next数组含义理解不透彻。。不能再这样下去了。。next[i]=j;表示到i前面字符串与原始字符匹配的子串长度。因此,next[n+1]数组需要开n+1大小 bool repeatedSubstringPattern(string s) { int i = 1; int原创 2017-06-08 22:49:19 · 289 阅读 · 0 评论