![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
LeetCode题解
Luciferwjd
这个作者很懒,什么都没留下…
展开
-
二维数组中的查找
存在一个m*n数组,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个高效的函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。原创 2022-08-10 14:51:37 · 107 阅读 · 1 评论 -
leetcode题解2-list用法实现列表相加
class Solution { public: ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) { ListNode *p = new ListNode(); ListNode *re = p; int jinwei = 0; while (l1 != NULL || l2 != NULL) { /* code */原创 2021-09-15 11:27:49 · 114 阅读 · 0 评论 -
LeetCode题解3:无重复字符串最长子串(使用滑动窗口)
滑动窗口 //普通版 class Solution { public: //定义len为无重复最长子串长度,l_s为传入字符串的长度,定义str来保存子串。 int lengthOfLongestSubstring(string s) { int len = 0 ,l_s = s.length(); string str = ""; for (int i = 0; i < l_s; i++) {//for循环遍历字符串s原创 2021-09-02 17:00:13 · 111 阅读 · 0 评论 -
Leetcode题解1
Leetcode题解1 1、使用两次循环,时间复杂度为哦…… // 使用两次for循环 vector<int> twoSum(vector<int>& nums, int target) { vector<int> v; int len = nums.size(); for (int i = 0;i < len-1;i++) { for (int j = i+1;j &l原创 2021-08-30 10:43:34 · 74 阅读 · 0 评论