• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
frankM
天下武功,唯快不破。
博客园 | 首页 | 新随笔 | 新文章 | 联系 | 订阅 订阅 | 管理
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 18 下一页

2014年11月23日

LeetCode Maximum Subarray
摘要: 链接: https://oj.leetcode.com/problems/maximum-subarray/最大连续子序列 动态规划class Solution{ public: int maxSubArray(int A[],int n) { int dp[n+1]; int ans=... 阅读全文
posted @ 2014-11-23 14:41 frankM 阅读(92) 评论(0) 推荐(0)
 
 

2014年11月22日

LeetCode Two Sum
摘要: 链接: https://oj.leetcode.com/problems/two-sum/在一个数组中找出两个值,使得他们的和等于 target; 返回相应的下标+1依次查找是存在值等于 target-numbers[i]class Solution{ public: vector twoSum(... 阅读全文
posted @ 2014-11-22 13:15 frankM 阅读(137) 评论(0) 推荐(0)
 
 

2014年11月20日

LeetCode Find Minimum in Rotated Sorted Array
摘要: 链接: https://oj.leetcode.com/problems/find-minimum-in-rotated-sorted-array/旋转数组 查找最小值 最小值肯定在旋转轴处 ,所以 用二分搜索找出旋转轴就可以了每次取中点,前后肯定有一截数是有序,另一截是无序..取无序的那部分继续搜... 阅读全文
posted @ 2014-11-20 20:16 frankM 阅读(160) 评论(0) 推荐(0)
 
 

2014年11月18日

LeetCode Add Binary
摘要: 链接: https://oj.leetcode.com/problems/add-binary/大数加法.二进制class Solution{ public: string addBinary(string a,string b) { bool sign=false; string an... 阅读全文
posted @ 2014-11-18 19:06 frankM 阅读(122) 评论(0) 推荐(0)
 
 

2014年11月15日

LeetCode Gray Code
摘要: 链接: https://oj.leetcode.com/problems/gray-code/格雷码 见维基百科 http://zh.wikipedia.org/wiki/%E6%A0%BC%E9%9B%B7%E7%A0%81知道原理后就很简单了class Solution{ public: ve... 阅读全文
posted @ 2014-11-15 21:05 frankM 阅读(110) 评论(0) 推荐(0)
 
 

2014年11月14日

POJ 1273 Drainage Ditches
摘要: 链接: http://poj.org/problem?id=1273最大流问题.#include #include #include #define MAX_M 200#define INF 100000000using namespace std;typedef struct{ int to; i... 阅读全文
posted @ 2014-11-14 21:21 frankM 阅读(128) 评论(0) 推荐(0)
 
 

2014年11月11日

LeetCode Word Break
摘要: 链接: https://oj.leetcode.com/problems/word-break/dp[i] 表示s[0~i] 能否分割成dict中的单词class Solution{ public: bool wordBreak(string s,unordered_set &dict) { ... 阅读全文
posted @ 2014-11-11 22:49 frankM 阅读(148) 评论(0) 推荐(0)
 
 

2014年11月8日

LeetCode Set Matrix Zeroes
摘要: 链接: https://oj.leetcode.com/problems/set-matrix-zeroes/把矩阵中的零全部投影到第一行和第一列..第一行和第一列中的零要单独考虑class Solution{ public: void setZeroes(vector > &matrix) ... 阅读全文
posted @ 2014-11-08 19:46 frankM 阅读(141) 评论(0) 推荐(0)
 
 

2014年11月4日

LeetCode Convert Sorted Array to Binary Search Tree
摘要: 链接: https://oj.leetcode.com/problems/convert-sorted-array-to-binary-search-tree/把一个有序数组转换成一棵AVL树/** * Definition for binary tree * struct TreeNode { *... 阅读全文
posted @ 2014-11-04 21:35 frankM 阅读(148) 评论(0) 推荐(0)
 
 

2014年11月2日

LeetCode Gas Station
摘要: 链接: https://oj.leetcode.com/problems/gas-station/网上的思路:如果 从i不能到 j 则从i~j之间的任何一个出发都不能到j如果 总的油量小与总的消耗量,则无论从哪出发,都不能到达class Solution{ public: int canCompl... 阅读全文
posted @ 2014-11-02 21:46 frankM 阅读(118) 评论(0) 推荐(0)
 
 
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 18 下一页

公告


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3