上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 43 下一页
摘要: 各种情况。有恶心的负数最值,用long long来做了。除此之外的情况下面都列出来了。/*1, 8 = 0.1251, 6 = 0.1(6)-50, 6 = -6.250, -3 = 0-1, -2147483648 = "0.0000000004656612873077392578125"*/ty... 阅读全文
posted @ 2014-12-31 23:05 阿牧遥 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 这道题,其实不简单。知道是26进制,怎么能够找规律找到+-1的位置呢?思路是去找 比如,AAB到AB的表达式的不变的地方,找到递推式。class Solution {public: string convertToTitle(int n) { string result; ... 阅读全文
posted @ 2014-12-31 23:04 阿牧遥 阅读(156) 评论(0) 推荐(0) 编辑
摘要: 黑帮火并简单版。多个数的有另一篇文章。class Solution {public: int majorityElement(vector &num) { int size = num.size(); int major = 0; int count ... 阅读全文
posted @ 2014-12-31 23:02 阿牧遥 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 本质是26进制,注意每次+1.class Solution {public: int titleToNumber(string s) { int size = s.size(); int num = 0; for (int i = 0; i < siz... 阅读全文
posted @ 2014-12-31 23:01 阿牧遥 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 老题,简单题。数5的个数就行了。class Solution {public: int trailingZeroes(int n) { int result = 0; while (n > 0) { result += n / 5; ... 阅读全文
posted @ 2014-12-31 23:00 阿牧遥 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 使用栈来记录可能的路径,栈顶一直是下一个元素。 class BSTIterator { public: stack<TreeNode *> path; BSTIterator(TreeNode *root) { path = stack<TreeNode *>(); TreeNode *node = 阅读全文
posted @ 2014-12-31 22:59 阿牧遥 阅读(150) 评论(0) 推荐(0) 编辑
摘要: https://codility.com/demo/take-sample-test/peakshttp://blog.csdn.net/caopengcs/article/details/17491791其实可以做到O(n)#include #include using namespace std... 阅读全文
posted @ 2014-11-20 12:35 阿牧遥 阅读(444) 评论(0) 推荐(0) 编辑
摘要: https://codility.com/programmers/challenges/fluorum2014http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1273http://blog.csdn.net/caopengc... 阅读全文
posted @ 2014-11-16 00:19 阿牧遥 阅读(277) 评论(0) 推荐(0) 编辑
摘要: https://codility.com/programmers/challenges/magnesium2014图形上的DP,先按照路径长度排序,然后依次遍历,状态是使用到当前路径为止的情况;每个节点记录以该节点结束的最长路径,这样加入新的路径时去更新。注意路径是双向的~#include #inc... 阅读全文
posted @ 2014-10-30 00:07 阿牧遥 阅读(167) 评论(0) 推荐(0) 编辑
摘要: https://www.hackerrank.com/contests/101hack/challenges/similarpair这题有点意思。在DFS遍历的过程中,用线段树去记录和查询区间的点数。要注意线段树的这种写法里面,index和begin,end是融为一体的,索引其实就决定了begin和... 阅读全文
posted @ 2014-10-24 22:46 阿牧遥 阅读(453) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 43 下一页