Loading

摘要: 题目 代码class Solution {public: bool isPowerOfThree(int n) { //3的19次方是3的倍数的最大值 //用换底公式 return n > 0 && (log(INT_MAX)/... 阅读全文
posted @ 2018-09-16 08:22 李正浩 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 题目 代码class Solution {public: int countPrimes(int n) { if(n<=2) return 0; int res=1; bool *prime = new b... 阅读全文
posted @ 2018-09-16 08:21 李正浩 阅读(121) 评论(0) 推荐(0) 编辑
摘要: 题目 代码class Solution {public: vector fizzBuzz(int n) { vector res; for(int i=1;i>str; res.push_back(str); ... 阅读全文
posted @ 2018-09-16 08:19 李正浩 阅读(74) 评论(0) 推荐(0) 编辑
摘要: 题目 代码class Solution {public: int maxSubArray(vector& nums) { vector max(nums.size(),0); if(nums.size()==0) ret... 阅读全文
posted @ 2018-09-16 08:18 李正浩 阅读(72) 评论(0) 推荐(0) 编辑
摘要: 题目 代码class Solution {public: int rob(vector& nums) { if(nums.size()==0) return 0; if(nums.size()==1) ... 阅读全文
posted @ 2018-09-16 08:18 李正浩 阅读(75) 评论(0) 推荐(0) 编辑
摘要: 题目 代码class Solution {public: int maxProfit(vector& prices) { if(prices.size()==0) return 0; vector salarys(pri... 阅读全文
posted @ 2018-09-16 08:16 李正浩 阅读(72) 评论(0) 推荐(0) 编辑
摘要: 题目 代码class Solution {public: int climbStairs(int n) { if(n==1) return 1; int step=0; int step1=... 阅读全文
posted @ 2018-09-16 08:16 李正浩 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 题目 代码// Forward declaration of isBadVersion API.bool isBadVersion(int version);class Solution {public: int firstBadVersion(int n) { ... 阅读全文
posted @ 2018-09-16 08:14 李正浩 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 题目 代码class Solution {public: void merge(vector& nums1, int m, vector& nums2, int n) { int i=0; while(i<n) { ... 阅读全文
posted @ 2018-09-16 08:13 李正浩 阅读(89) 评论(0) 推荐(0) 编辑
摘要: 一、int转string#include #include int main() { double f = 23.43; double f2 = 1e-9; double f3 = 1e40; double f4 = 1e-40; double... 阅读全文
posted @ 2018-09-16 08:08 李正浩 阅读(850) 评论(0) 推荐(0) 编辑