随笔分类 -  LeetCode

上一页 1 ··· 8 9 10 11 12 13 下一页
摘要:"题目" c++ class Solution { public: string longestCommonPrefix(vector& strs) { if(strs.size()==0) return ""; int i=0; string ans=""; while(true) { if(i= 阅读全文
posted @ 2019-06-22 10:17 Shendu.CC 阅读(95) 评论(0) 推荐(0)
摘要:"题目" c++ 阅读全文
posted @ 2019-06-22 10:16 Shendu.CC 阅读(97) 评论(0) 推荐(0)
摘要:"题目" class Solution { public: int v[7]={1,5,10,50,100,500,1000}; string s[7]={"I","V","X","L","C","D","M"}; string intToRoman(int num) { string ans="" 阅读全文
posted @ 2019-06-22 09:47 Shendu.CC 阅读(149) 评论(0) 推荐(0)
摘要:"题目" class Solution { public: int s[10005]; int maxArea(vector& height) { int ans=0; int l=0; int r=height.size() 1; while(l 阅读全文
posted @ 2019-06-20 17:21 Shendu.CC 阅读(94) 评论(0) 推荐(0)
摘要:"题目" 大模拟 c++ class Solution { public: int dp[1005][1005]; bool ans; bool isMatch(string s, string p) { return judge(s,p,0,0); } bool judge(string s,st 阅读全文
posted @ 2019-06-20 15:58 Shendu.CC 阅读(131) 评论(0) 推荐(0)
摘要:"题目" c++ class Solution { public: int a[100005]; bool isPalindrome(int x) { if(x 阅读全文
posted @ 2019-06-17 08:46 Shendu.CC 阅读(107) 评论(0) 推荐(0)
摘要:"题目" c++ 多注意注意 class Solution { public: int myAtoi(string str) { int len = str.length(); int tag=0; int tag2=0; char tag3='x'; string num=""; for(int 阅读全文
posted @ 2019-06-15 10:24 Shendu.CC 阅读(125) 评论(0) 推荐(0)
摘要:"题目" c++ class Solution { public: int reverse(int x) { long long int ans=0; int tag=0; while(x) { long long int y =x%10; x/=10; if(y==0&&tag==0) conti 阅读全文
posted @ 2019-06-03 09:03 Shendu.CC 阅读(108) 评论(1) 推荐(0)
摘要:"题目" 算模拟题吧 class Solution { public: char a[1000][1000]; int tag[1000][1000]; string convert(string s, int numRows) { if(numRows==0||numRows==1) return 阅读全文
posted @ 2019-06-01 11:04 Shendu.CC 阅读(115) 评论(0) 推荐(0)
摘要:"题目" c++ 回文串,区间DP class Solution { public: int dp[1005][1005]; string longestPalindrome(string s) { int len = s.length(); int ii,jj; int m=0; for(int 阅读全文
posted @ 2019-05-31 13:19 Shendu.CC 阅读(114) 评论(1) 推荐(0)
摘要:"题目" c++ 阅读全文
posted @ 2019-05-29 09:05 Shendu.CC 阅读(115) 评论(2) 推荐(0)
摘要:"题目" 阅读全文
posted @ 2019-05-23 10:54 Shendu.CC 阅读(97) 评论(0) 推荐(0)
摘要:"题目" class Solution { public: vector twoSum(vector& nums, int target) { vector res; for(int i=0;i 阅读全文
posted @ 2019-05-23 10:53 Shendu.CC 阅读(95) 评论(0) 推荐(0)
摘要:"题目" c++ 阅读全文
posted @ 2019-05-20 18:09 Shendu.CC 阅读(75) 评论(0) 推荐(0)
摘要:"题目" 二分 一不小心耗时超过100%的c++解决方案。哈哈哈 阅读全文
posted @ 2019-05-16 13:46 Shendu.CC 阅读(90) 评论(0) 推荐(0)
摘要:"题目" c++ 阅读全文
posted @ 2019-04-25 18:00 Shendu.CC 阅读(82) 评论(0) 推荐(0)
摘要:"题目" 煞笔题目,怪不得那么多人diss 两层for循环,它还疯狂卡精度,double的精度不够,必须long double 阅读全文
posted @ 2019-04-25 11:18 Shendu.CC 阅读(126) 评论(0) 推荐(0)
摘要:"题目" 实现一个缓存机制。很多人的写法都是使用HashTable, Map,Dictionary 或者别的工具。 但是我,自己硬核手写了一个可插入删除的AVL树,并且把这道题目给过了 代码实在有点偏长,以后再重构代码。 过程中Wa了很多次,最后一次的AC的感觉,真是找到以前比赛时候的感觉。 阅读全文
posted @ 2019-04-09 14:23 Shendu.CC 阅读(179) 评论(1) 推荐(0)
摘要:"LeetCode 150 Evaluate Reverse Polish Notation" 后缀表达式,利用栈就可以轻松计算 c++ class Solution { public: int stack[10005]; int pos=0; int evalRPN(vector& tokens) 阅读全文
posted @ 2019-03-12 08:32 Shendu.CC 阅读(104) 评论(0) 推荐(0)
摘要:LeetCode 148 Sort List 排序, 我使用了三种排序: 手写快排: 48ms C++模板快排: 48ms 堆排序:52ms c++: 阅读全文
posted @ 2019-03-10 10:01 Shendu.CC 阅读(131) 评论(0) 推荐(0)

上一页 1 ··· 8 9 10 11 12 13 下一页