自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(21)
  • 资源 (9)
  • 收藏
  • 关注

原创 382. Linked List Random Node

class Solution { private: ListNode *head;public: /** @param head The linked list's head. Note that the head is guaranteed to be not null, so it contains at least one node. */ Soluti

2016-12-28 15:39:46 313

原创 375. Guess Number Higher or Lower II

class Solution {public: int getMoneyAmount(int n) { vector<vector<int>> dp(n+1,vector<int>(n+1,0)); for(int i=2;i<=n;i++) { for(int j=i-1;j>=1;j--) {

2016-12-26 14:43:11 305

原创 372. Super Pow

class Solution { private: int base=1337; int mypow(int a,int k) { a%=base; int ret=1; for(int i=0;i<k;i++) { ret=(ret*a)%base; }

2016-12-21 15:23:10 409

原创 368. Largest Divisible Subset

class Solution { public: vector<int> largestDivisibleSubset(vector<int>& nums) { vector<int> ret; if(nums.size()==0) return ret; int m=0; int mi=0;

2016-12-21 14:30:38 384

原创 371. Sum of Two Integers

class Solution { public: int getSum(int a, int b) { if(a==0) return b; if(b==0) return a; while(b!=0) { int carry=a&b;

2016-12-21 10:12:14 251

原创 367. Valid Perfect Square

class Solution { public: bool isPerfectSquare(int num) { int i=1; while(num>0) { num-=i; i+=2; } return num==0; } };

2016-12-20 10:10:01 331

原创 365. Water and Jug Problem

public class Solution { public boolean canMeasureWater(int x, int y, int z) { if(x+y<z) return false; if(x==z||x==z||x+y==z) return true; if(x<y)

2016-12-19 14:20:44 315

原创 459. Repeated Substring Pattern

public class Solution { public boolean repeatedSubstringPattern(String str) { int l=str.length(); for(int i=l/2;i>=1;i--) { if(l%i==0)//如果l是i的整数倍 {

2016-12-19 10:02:58 349

原创 363. Max Sum of Rectangle No Larger Than K

class Solution { public: int maxSumSubmatrix(vector<vector<int>>& matrix, int k) { int row=matrix.size(); if(row==0) return 0; int col=matrix[0].size();

2016-12-17 13:00:46 349

原创 357. Count Numbers with Unique Digits

class Solution { public: int countNumbersWithUniqueDigits(int n) { if(n==0) return 1; int ret=10; int unique=9; int available=9; while(n>1&&available

2016-12-15 10:26:20 308

原创 355. Design Twitter

public class Twitter { private Map<Integer,user> usermap; private static int timestamp=0; class twitte{ int id; int time; twitte next; twitte(int id){

2016-12-13 15:15:21 392

原创 341. Flatten Nested List Iterator

class NestedIterator { private: stack<NestedInteger> s; public: NestedIterator(vector<NestedInteger> &nestedList) { for(int i=nestedList.size()-1;i>=0;i--) { s.push(

2016-12-11 10:25:39 327

原创 342. Power of Four

class Solution { public: bool isPowerOfFour(int num) { float a=log(num)/log(4); if(a-int(a)==0) return true; else return false; } };

2016-12-09 10:40:21 241

原创 343. Integer Break

class Solution { public: int integerBreak(int n) { if(n==2) return 1; if(n==3) return 2; int product=1; while(n>4) { prod

2016-12-09 10:36:19 234

原创 345. Reverse Vowels of a String

class Solution { public: string reverseVowels(string s) { vector<int> positions; for(int i=0;i<s.size();i++) { char temp=s[i]; if(temp=='a'||temp=='e

2016-12-08 10:45:56 267

原创 344. Reverse String

class Solution { public: string reverseString(string s) { if(!s.size()) return s; int l=0; int r=s.size()-1; while(l<r) { char temp=s

2016-12-08 10:30:58 220

原创 334. Increasing Triplet Subsequence

class Solution { public: bool increasingTriplet(vector<int>& nums) { int c1=INT_MAX; int c2=INT_MAX; for(int n:nums) { if(n<=c1) c1=n;

2016-12-08 10:26:14 224

原创 332. Reconstruct Itinerary

class Solution { private: map<string,multiset<string>> targets; vector<string> route; void visit(string start) { while(targets[start].size())//当这个点有从此点出发的路径时就不断的dfs {

2016-12-07 12:15:00 314

原创 329. Longest Increasing Path in a Matrix

class Solution { private: int pathHelper(int i,int j,vector<vector<int>> &matrix,vector<vector<int>> &cache) { if(cache[i][j]!=0) return cache[i][j]; int

2016-12-06 14:25:50 234

原创 327. Count of Range Sum

class Solution { private: int countHelper(vector<long>&sum,int start,int end,int lower,int upper) { if(end-start<=1)//sum个数小于等于1无法求范围 return 0; int mid=(start+end)/2

2016-12-03 15:19:40 439

原创 328. Odd Even Linked List

class Solution { public: ListNode* oddEvenList(ListNode* head) { if(!head) return head; ListNode *odd=head; ListNode *even=head->next; ListNode *evencopy

2016-12-01 11:43:57 258

PID算法介绍

pid算法是用于反馈控制的算法 适合于工业控制

2012-10-07

数字电路教程

很好的数字电路入门资源,非常适合入门 数字电路是基础哦

2012-09-23

TMP100驱动

温度传感器TMP100的驱动代码,可以直接拿过来用的

2012-09-18

安卓开发门必读

安卓开发必读 Android

2012-05-13

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除