
oj
文章平均质量分 77
xiaomengxian1998
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
leetcode28
题目链接:https://leetcode.com/problems/implement-strstr/ Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. 思路:按照简单的做可转载 2017-07-31 22:52:50 · 458 阅读 · 0 评论 -
leetcode 2
ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) { int carry=0,sum,x,y; ListNode q(0),*tmp1=l1,*tmp2=l2,*re=&q; while(tmp1||tmp2) { x=tm原创 2017-08-01 20:37:35 · 331 阅读 · 0 评论 -
leetcode 1
题目描述: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution, and you may not use原创 2017-08-02 15:56:20 · 236 阅读 · 0 评论 -
leetcode 3
首先分析一下时间最短的解法int lengthOfLongestSubstring(string s) { vector vec(256,-1); int i,start=-1,maxLength=0; for(i=0;i<s.size();i++) { if(vec[s[i]]>start) start=vec原创 2017-08-03 16:36:30 · 303 阅读 · 0 评论 -
leetcode 4
这是我第一次刷leetcode做的最顺利的一道题了吧,但是还不是一次性提交的,下面是我的代码: double findMedianSortedArrays(vector& nums1, vector& nums2) { int l1=nums1.size(),l2=nums2.size(),sz=nums1.size()+nums2.size(),i=0,j=0;原创 2017-08-04 20:47:35 · 238 阅读 · 0 评论 -
leetcode 6
看完题目就蒙圈了,所以就直接看了别人的答案 几个答案看下来,基本上有这么三种思路 1.最清晰易懂的一种 string convert(string s,int numRows){ if(s.size() return s; int len=s.size(),j,row=0,step=1; string *str=new string[numRows]; f原创 2017-08-19 15:21:10 · 698 阅读 · 0 评论