上一页 1 2 3 4 5 6 ··· 15 下一页
摘要: 1 #include <stdio.h> 2 #include <stdlib.h> 3 typedef int ElemType; 4 typedef struct LinkNode{ 5 ElemType data; 6 struct LinkNode *next; 7 }LinkNode; 8 阅读全文
posted @ 2020-03-21 15:09 wydxry 阅读(361) 评论(0) 推荐(0) 编辑
摘要: 1 #include <stdio.h> 2 #include <stdlib.h> 3 #define MaxSize 5 4 typedef int ElemType; 5 typedef struct{ 6 //数组,存储MaxSize-1个元素 7 ElemType data[MaxSize 阅读全文
posted @ 2020-03-21 15:03 wydxry 阅读(791) 评论(0) 推荐(0) 编辑
摘要: 以栈的顺序存储结构为例: 1 #include <stdio.h> 2 #include <stdlib.h> 3 #define MaxSize 50 4 typedef int ElemType; 5 typedef struct{ 6 ElemType data[MaxSize];//数组 7 阅读全文
posted @ 2020-03-21 14:56 wydxry 阅读(341) 评论(0) 推荐(0) 编辑
摘要: 1 #include <stdio.h> 2 #include <stdlib.h> 3 typedef int ElemType; 4 typedef struct DNode{ 5 ElemType data; 6 struct DNode *prior,*next; 7 }DNode,*DLi 阅读全文
posted @ 2020-03-21 14:51 wydxry 阅读(535) 评论(0) 推荐(0) 编辑
摘要: 1 #include <stdio.h> 2 #include <stdlib.h> 3 typedef int ElemType; 4 typedef struct LNode{ 5 ElemType data; 6 struct LNode *next; 7 }LNode,*LinkList; 阅读全文
posted @ 2020-03-21 14:45 wydxry 阅读(383) 评论(0) 推荐(0) 编辑
摘要: 1 #include <stdio.h> 2 #include <stdlib.h> 3 #define MaxSize 50 4 typedef int ElemType; 5 //静态分配 6 typedef struct{ 7 ElemType data[MaxSize]; 8 int len 阅读全文
posted @ 2020-03-21 14:39 wydxry 阅读(355) 评论(0) 推荐(0) 编辑
摘要: Python环境变量配置备份导出安装包,查看第三方扩展: 在源文件的 venv文件夹下输入CMD,在CMD窗口中输入如下命令: freeze 查询各种安装包的版本, > 重定向到requirements文本,文本名字可随意命名 pip freeze > requirements.txt 此时安装包扩 阅读全文
posted @ 2020-03-16 11:12 wydxry 阅读(290) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/pond-sizes-lcci/ 你有一个用于表示一片土地的整数矩阵land,该矩阵中每个点的值代表对应地点的海拔高度。若值为0则表示水域。由垂直、水平或对角连接的水域为池塘。池塘的大小是指相连接的水域的个数。编写一个方法来 阅读全文
posted @ 2020-03-16 09:20 wydxry 阅读(1540) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/island-perimeter/ 给定一个包含 0 和 1 的二维网格地图,其中 1 表示陆地 0 表示水域。 网格中的格子水平和垂直方向相连(对角线方向不相连)。整个网格被水完全包围,但其中恰好有一个岛屿(或者说,一个或 阅读全文
posted @ 2020-03-16 08:59 wydxry 阅读(243) 评论(0) 推荐(1) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/max-area-of-island/ 给定一个包含了一些 0 和 1的非空二维数组 grid , 一个 岛屿 是由四个方向 (水平或垂直) 的 1 (代表土地) 构成的组合。你可以假设二维矩阵的四个边缘都被水包围着。 找到 阅读全文
posted @ 2020-03-16 08:42 wydxry 阅读(336) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/surrounded-regions/ 给定一个二维的矩阵,包含 'X' 和 'O'(字母 O)。 找到所有被 'X' 围绕的区域,并将这些区域里所有的 'O' 用 'X' 填充。 示例: X X X XX O O XX X 阅读全文
posted @ 2020-03-13 09:13 wydxry 阅读(243) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/number-of-islands/ 给定一个由 '1'(陆地)和 '0'(水)组成的的二维网格,计算岛屿的数量。一个岛被水包围,并且它是通过水平方向或垂直方向上相邻的陆地连接而成的。你可以假设网格的四个边均被水包围。 示例 阅读全文
posted @ 2020-03-12 23:53 wydxry 阅读(383) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/number-of-islands/ 给定一个由 '1'(陆地)和 '0'(水)组成的的二维网格,计算岛屿的数量。一个岛被水包围,并且它是通过水平方向或垂直方向上相邻的陆地连接而成的。你可以假设网格的四个边均被水包围。 示例 阅读全文
posted @ 2020-03-12 23:34 wydxry 阅读(230) 评论(0) 推荐(0) 编辑
摘要: Win10下Anaconda的命令行相关操作 在任务栏的搜索框里搜Anaconda Promp如下图所示: 点击后运行如下图所示: 想要在anaconda里面创建环境可以使用如下代码: conda create -n 环境名称 版本 例如我要创建一个名字为teste37的python3.7的环境可以 阅读全文
posted @ 2020-03-09 23:04 wydxry 阅读(1382) 评论(0) 推荐(0) 编辑
摘要: pip install 包名 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com 问题起因如下图: 出错的原因: 1、可能cv2相关包没有安装完; 2、可能缺少相关包。 针对第一种情况: 可以先卸载相关包,卸载语句如下: p 阅读全文
posted @ 2020-03-09 23:00 wydxry 阅读(20024) 评论(0) 推荐(3) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/maximum-subarray/ 给定一个整数数组 nums ,找到一个具有最大和的连续子数组(子数组最少包含一个元素),返回其最大和。 示例: 输入: [-2,1,-3,4,-1,2,1,-5,4],输出: 6解释: 连 阅读全文
posted @ 2020-03-09 16:27 wydxry 阅读(118) 评论(0) 推荐(0) 编辑
摘要: 题目描述: 输入一个链表,按链表从尾到头的顺序返回一个ArrayList。 思路:链表逆序放入ArrayList。 1 /** 2 * struct ListNode { 3 * int val; 4 * struct ListNode *next; 5 * ListNode(int x) : 6 阅读全文
posted @ 2020-03-09 10:54 wydxry 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 1 #include <stdio.h> 2 #include <stdlib.h> 3 #include <string.h> 4 int main() 5 { 6 char *src="hello,world"; 7 char *dest,*d,*p; 8 int len,i; 9 len=st 阅读全文
posted @ 2020-03-08 18:14 wydxry 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 1 void swap(char *p,char *q) 2 { 3 char tmp[100]; 4 strcpy(tmp,p); 5 strcpy(p,q); 6 strcpy(q,tmp); 7 } 或者 1 void swap(char *p,char *q) 2 { 3 char tmp; 阅读全文
posted @ 2020-03-08 18:05 wydxry 阅读(289) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/insertion-sort-list/ 插入排序算法: 插入排序是迭代的,每次只移动一个元素,直到所有元素可以形成一个有序的输出列表。每次迭代中,插入排序只从输入数据中移除一个待排序的元素,找到它在序列中适当的位置,并将其 阅读全文
posted @ 2020-03-07 10:56 wydxry 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/linked-list-cycle-lcci/ 给定一个有环链表,实现一个算法返回环路的开头节点。有环链表的定义:在链表中某个节点的next元素指向在它前面出现过的节点,则表明该链表存在环路。 示例 1: 输入:head = 阅读全文
posted @ 2020-03-07 09:47 wydxry 阅读(330) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/reverse-linked-list-ii/ 反转从位置 m 到 n 的链表。请使用一趟扫描完成反转。 说明:1 ≤ m ≤ n ≤ 链表长度。 示例: 输入: 1->2->3->4->5->NULL, m = 2, n 阅读全文
posted @ 2020-03-06 19:13 wydxry 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/reorder-list/ 给定一个单链表 L:L0→L1→…→Ln-1→Ln ,将其重新排列后变为: L0→Ln→L1→Ln-1→L2→Ln-2→… 你不能只是单纯的改变节点内部的值,而是需要实际的进行节点交换。 示例 1 阅读全文
posted @ 2020-03-06 11:39 wydxry 阅读(235) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/convert-sorted-array-to-binary-search-tree/ 将一个按照升序排列的有序数组,转换为一棵高度平衡二叉搜索树。 本题中,一个高度平衡二叉树是指一个二叉树每个节点 的左右两个子树的高度差的 阅读全文
posted @ 2020-03-04 10:49 wydxry 阅读(200) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/partition-list/ 给定一个链表和一个特定值 x,对链表进行分隔,使得所有小于 x 的节点都在大于或等于 x 的节点之前。 你应当保留两个分区中每个节点的初始相对位置。 示例: 输入: head = 1->4-> 阅读全文
posted @ 2020-03-04 10:00 wydxry 阅读(158) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/he-wei-sde-liang-ge-shu-zi-lcof/ 输入一个递增排序的数组和一个数字s,在数组中查找两个数,使得它们的和正好是s。如果有多对数字的和等于s,则输出任意一对即可。 示例 1: 输入:nums = 阅读全文
posted @ 2020-03-04 09:35 wydxry 阅读(282) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/shu-zu-zhong-chu-xian-ci-shu-chao-guo-yi-ban-de-shu-zi-lcof/ 数组中有一个数字出现的次数超过数组长度的一半,请找出这个数字。 你可以假设数组是非空的,并且给定的数组 阅读全文
posted @ 2020-03-04 00:18 wydxry 阅读(358) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/shu-zu-zhong-zhong-fu-de-shu-zi-lcof/ 找出数组中重复的数字。 在一个长度为 n 的数组 nums 里的所有数字都在 0~n-1 的范围内。数组中某些数字是重复的,但不知道有几个数字重复了 阅读全文
posted @ 2020-03-04 00:01 wydxry 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/diao-zheng-shu-zu-shun-xu-shi-qi-shu-wei-yu-ou-shu-qian-mian-lcof/ 输入一个整数数组,实现一个函数来调整该数组中数字的顺序,使得所有奇数位于数组的前半部分,所 阅读全文
posted @ 2020-03-03 23:50 wydxry 阅读(199) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/ti-huan-kong-ge-lcof/ 请实现一个函数,把字符串 s 中的每个空格替换成"%20"。 示例 1: 输入:s = "We are happy." 输出:"We%20are%20happy." 限制: 0 < 阅读全文
posted @ 2020-03-03 23:35 wydxry 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/cong-wei-dao-tou-da-yin-lian-biao-lcof/ 输入一个链表的头节点,从尾到头反过来返回每个节点的值(用数组返回)。 示例 1: 输入:head = [1,3,2]输出:[2,3,1] 限制: 阅读全文
posted @ 2020-03-03 23:23 wydxry 阅读(344) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/fan-zhuan-lian-biao-lcof/ 定义一个函数,输入一个链表的头节点,反转该链表并输出反转后链表的头节点。 示例: 输入: 1->2->3->4->5->NULL输出: 5->4->3->2->1->NUL 阅读全文
posted @ 2020-03-03 23:18 wydxry 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/er-cha-shu-de-shen-du-lcof/ 输入一棵二叉树的根节点,求该树的深度。从根节点到叶节点依次经过的节点(含根、叶节点)形成树的一条路径,最长路径的长度为树的深度。 例如: 给定二叉树 [3,9,20,n 阅读全文
posted @ 2020-03-03 23:05 wydxry 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/zuo-xuan-zhuan-zi-fu-chuan-lcof/ 字符串的左旋转操作是把字符串前面的若干个字符转移到字符串的尾部。请定义一个函数实现字符串左旋转操作的功能。比如,输入字符串"abcdefg"和数字2,该函数将 阅读全文
posted @ 2020-03-03 22:45 wydxry 阅读(174) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/remove-duplicates-from-sorted-list-ii/ 给定一个排序链表,删除所有含有重复数字的节点,只保留原始链表中 没有重复出现 的数字。 示例 1: 输入: 1->2->3->3->4->4->5 阅读全文
posted @ 2020-03-03 17:14 wydxry 阅读(176) 评论(0) 推荐(0) 编辑
摘要: 之前的题目是:LeetCode 83. 删除排序链表中的重复元素 我改了下前提条件,排序链表改为非排序链表。 1 /** 2 * Definition for singly-linked list. 3 * struct ListNode { 4 * int val; 5 * struct List 阅读全文
posted @ 2020-03-03 16:40 wydxry 阅读(215) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/rotate-list/ 给定一个链表,旋转链表,将链表每个节点向右移动 k 个位置,其中 k 是非负数。 示例 1: 输入: 1->2->3->4->5->NULL, k = 2输出: 4->5->1->2->3->NUL 阅读全文
posted @ 2020-03-03 16:21 wydxry 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/remove-nth-node-from-end-of-list/ 给定一个链表,删除链表的倒数第 n 个节点,并且返回链表的头结点。 示例: 给定一个链表: 1->2->3->4->5, 和 n = 2. 当删除了倒数第二 阅读全文
posted @ 2020-03-03 16:01 wydxry 阅读(210) 评论(0) 推荐(0) 编辑
摘要: 题目描述 完成一个递归程序,倒置字符数组。并打印实现过程 递归逻辑为: 当字符长度等于1时,直接返回 否则,调换首尾两个字符,在递归地倒置字符数组的剩下部分 输入 字符数组长度及该数组 输出 在求解过程中,打印字符数组的变化情况。 最后空一行,在程序结尾处打印倒置后该数组的各个元素。 样例输入 5 阅读全文
posted @ 2020-03-03 10:54 wydxry 阅读(377) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://leetcode-cn.com/problems/sum-lists-lcci/ 给定两个用链表表示的整数,每个节点包含一个数位。 这些数位是反向存放的,也就是个位排在链表首部。 编写函数对这两个整数求和,并用链表形式返回结果。 示例: 输入:(7 -> 1 -> 6) + 阅读全文
posted @ 2020-03-03 09:40 wydxry 阅读(837) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 15 下一页
Live2D