自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

jsh0123的博客

程序狗&&中国科学院计算技术研究所在读学生

  • 博客(12)
  • 资源 (1)
  • 收藏
  • 关注

原创 LeetCode Best Time to Buy and Sell Stock II C 4ms

int maxProfit(int* prices, int pricesSize) { int max=0,i=0,muturs=0,buy=0,sell=0; for(i;i<pricesSize-1;i++){ if(prices[i]<=prices[i+1]) { if(muturs&&sell)

2016-01-31 14:31:05 228

原创 LeetCode Excel Sheet Column Number

int titleToNumber(char* s) { int length=strlen(s),num=0,i=0; while(i<length) { num=num+(s[i]-64)*pow(26,length-i-1);//方法一 //num=s[i]-64+num*26;//方法二 i++; }

2016-01-31 00:06:38 197

原创 LeetCode Valid Anagram Hashtable

bool isAnagram(char* s, char* t) { int ls=strlen(s),lt=strlen(t),i=0,su[26],lu[26]; memset(su, 0, sizeof(int)*26); memset(lu, 0, sizeof(int)*26); if(ls!=lt) return false; e

2016-01-30 23:17:53 245

原创 Excel Sheet Column Title

char* convertToTitle(int n) { char *asc1; int i=0,j,high,temp=n; while((temp-1)/26!=0)//第二种思考方式的时候这个循环将无用 { i++; temp=(temp-1)/26; } asc1 = (char *)mal

2016-01-30 22:22:47 264

原创 LeetCode Single Number XOR

int singleNumber(int* nums, int numsSize) { int p=nums[0]; for(int i=1;i<numsSize;i++) { p^=nums[i]; } return p;}这是根据论坛上的XOR(异或)方式写的答案。^是C语言的位运算符,按位异或的意思.a^b就是拿a和

2016-01-29 11:39:00 290

原创 LeetCode Nim Game

bool canWinNim(int n) { return n%4==0?false:true;}一行C语言版,纯自己想出来的。这道题难点在于,不好想规律,想出规律得心应手。2016/1/29

2016-01-29 09:41:09 179

原创 LeetCode Same Tree

/** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */bool isSameTree(struct TreeNode* p, struct TreeNod

2016-01-28 23:29:31 219

原创 LeetCode Move Zeroes

void moveZeroes(int* nums, int numsSize) { int rec=0,i; for(i=0;i<numsSize;i++) { if(nums[i]==0){ rec++; } else { nums[i-rec]=nums[

2016-01-28 17:14:14 216

原创 LeeCode Invert Binary Tree

/** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */struct TreeNode* invertTree(struct TreeNode* r

2016-01-28 16:47:06 271

原创 LeetCode vDelete Node in a Linked List

/** * Definition for singly-linked list. * struct ListNode { * int val; * struct ListNode *next; * }; */void deleteNode(struct ListNode* node) { struct ListNode* first=node->next;

2016-01-28 16:20:38 293

原创 LeetCode Maximum Depth of Binary tree

/** * Definition for a binary tree node. * struct TreeNode { * int val; * struct TreeNode *left; * struct TreeNode *right; * }; */int maxDepth(struct TreeNode* root) { int Dlef

2016-01-28 15:46:14 261

原创 LeetCode AddDigits

int addDigits(int num) { if(num>9) { num=num%10+addDigits(num/10); addDigits(num); } else return num;}递归算法。2016年1月28日想法。

2016-01-28 12:42:20 328

中国石油大学校园导航源代码

可算最短路径,可显示最短距离,可显示航拍地图,可显示经典详细信息

2012-07-19

空空如也

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

TA关注的人

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