自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(58)
  • 收藏
  • 关注

原创 VUE+Springboot前后端分离项目开发04

开始写注册登录功能先前Home界面是在App.vue里嵌入的,<router-view>就是展示的home的区域,但是这样路由存在问题。首先改造App.vue,新建Layout,包含头部,侧边栏和主体,作为后台主页框架重新配置路由,实现后台主页的访问。现在App.vue里的<router-view>作为全局根节点进行访问,访问后台主体是需要进行嵌套路由这样把页面就都放入了Layout进行展示,login也放在了框架之外。先...

2021-09-15 16:37:26 98

原创 VUE+Springboot前后端分离项目开发03

使用axios进行前后台数据交互,在Vue中新建一个utils文件夹,在其中写一个request.js文件,使用其封装axios这个前后端交互的插件。首先安装复制粘贴引入之后在Home.vue中引用,需补全确定按钮中的save方法,在save方法中写逻辑在save中首先需引入request对象(request.js中),使用request.post方法请求后台,在弹窗中,我们输入值,就会被绑定到form的对应属性中去,this.form就在request.post方法中作为请求...

2021-09-15 09:20:03 366

原创 VUE+Springboot前后端分离项目开发02

开始写后台进入start.spring.io,创建springboot工程依赖选择GENERATE创建项目得到一个demo.zip文件夹,回到IDEA,工程中新建Moudle选择Maven命名为springboot之后IDEA即创建了名为springboot的maven工程,去掉自带的src和pom文件把demo.zip中的src和pom文件复制过来,等待IDEA导完依赖重新梳理文件目录命名为vue,将原目录下的文件复制进vue Directo..

2021-09-14 15:32:36 213

原创 VUE+Springboot前后端分离项目开发01

首先下载node.js,其自带npm包进行工程创建和依赖管理下载安装完成后在cmd中可以查看版本,安装命令行工具vue-cli插件来进行vue工程的创建npm install -g @vue-cli之后开始创建项目vue create 项目名回车进入选择Manually select features勾选后进入Choose Vue version安装完成按照提示命令启动项目CtrlC停止命令行操作,拖入IDEA打开...

2021-09-10 17:36:30 185 1

原创 SSD从头训练的实现

1.标注数据https://cloud.tencent.com/developer/news/3258762.处理标注数据按照VOC数据集的要求,创建以下文件夹Annotations:用于存放标注后的xml文件ImageSets/Main:用于后续存放训练集、测试集、验收集的文件列表JPEGImages:用于存放原始图像下载自动划分脚本,与三个数据文件放在同一目录下h...

2019-10-09 10:51:17 424

原创 202. Happy Number python

编写一个算法判断某个数字是否是“快乐数”。快乐数的定义过程如下:从任意一个正整数开始,将原数替换为其每一位的平方和,重复此过程会得到两种可能:1.数字=1(此时其值将不再变化),2.进入一个不包含1的无限循环。那些以1为终止的数字即为“快乐数”。Example: 19 is a happy number12 + 92 = 8282 + 22 = 6862 + 82 = 10012 + 02 + 0...

2018-04-23 15:17:20 660

原创 205. Isomorphic Strings python

给定两个字符串s和t,判断它们是否是同构的。如果字符串s可以通过字符替换的方式得到字符串t,则称s和t是同构的。class Solution(object): def isIsomorphic(self, s, t): """ :type s: str :type t: str :rtype: bool """...

2018-04-23 15:07:04 146

原创 242. Valid Anagram python

给定字符串s和t,编写函数判断t是否为s的anagram(字谜游戏,由颠倒字母顺序而构成的字[短语])。class Solution(object): def isAnagram(self, s, t): """ :type s: str :type t: str :rtype: bool """ ...

2018-04-23 15:05:34 209

原创 438. Find All Anagrams in a String python

给定一个字符串s和一个非空字符串p,找出s中所有p的字符串的起始索引。Input:s: "cbaebabacd" p: "abc"Output:[0, 6]Explanation:The substring with start index = 0 is "cba", which is an anagram of "abc".The substring with start index = 6 i...

2018-04-22 21:06:44 199

原创 409. Longest Palindrome python

给定一个只包含小写或者大写字母的字符串,寻找用这些字母可以组成的最长回文串的长度。大小写敏感,例如"Aa"在这里不认为是一个回文。思路:统计每个字母的出现次数:若字母出现偶数次,则直接累加至最终结果, 若字母出现奇数次,则将其值-1之后累加至最终结果,出现奇数次的字母只算一次class Solution(object): def longestPalindrome(self, s): ...

2018-04-22 19:22:38 266

原创 771. Jewels and Stones python

给定字符串J和S,求S中在J中出现的字符总数。class Solution(object): def numJewelsInStones(self, J, S): """ :type J: str :type S: str :rtype: int """ return sum(s in J fo...

2018-04-22 19:01:05 147

原创 387. First Unique Character in a String python

给定一个字符串,找到它中的第一个非重复字符并返回它的索引。 如果它不存在,则返回-1。class Solution(object): def firstUniqChar(self, s): """ :type s: str :rtype: int """ ans = -1 Dict = coll...

2018-04-22 18:56:02 200

原创 350. Intersection of Two Arrays II python

给定两个数组,写一个函数来计算它们的交集。注意 结果中的每个元素的出现次数应与其在两个数组中同时出现的次数一样多。Example:Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2].class Solution(object): def intersect(self, nums1, nums2): """ ...

2018-04-22 18:49:13 145

原创 349. Intersection of Two Arrays python

给定两个数组,写一个函数来计算它们的交集。class Solution(object): def intersection(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: List[int] """ ...

2018-04-22 18:41:04 99

原创 290. Word Pattern python

给定一个模式pattern和一个字符串str,判断str是否满足相同的pattern。测试用例如题目描述。Examples:pattern = "abba", str = "dog cat cat dog" should return true.pattern = "abba", str = "dog cat cat fish" should return false.pattern = "aaa...

2018-04-22 18:38:27 190

原创 447. Number of Boomerangs python

给定平面中所有成对的不同点的n个点,一个“回旋镖”是一个点(i,j,k)的元组,使得i和j之间的距离等于i和k之间的距离。找到回旋镖的数量。题目的难点在于发现‘对于每一个点,有k个距离为d的点,就有k *(k-1)种组合’举例说明,比如有一个点a,和它距离都是1的点有b,c,d,那么一共的组合就有6种,包括:[a, b, c], [a, c, b], [a, b, d], [a, d, b], [...

2018-04-21 17:47:15 178

原创 594. Longest Harmonious Subsequence python

我们定义一个和谐数组是一个数组,其最大值和最小值之间的差值恰好为1。现在,给定一个整数数组,你需要在其所有可能的子序列中找出其最长的和谐子序列的长度。注意,和谐数组不一定要求连续class Solution(object): def findLHS(self, nums): """ :type nums: List[int] :rtype: ...

2018-04-21 17:32:52 176

原创 599. Minimum Index Sum of Two Lists python

求两个字符串列表中索引之和最小的公共串class Solution(object): def findRestaurant(self, list1, list2): """ :type list1: List[str] :type list2: List[str] :rtype: List[str] """ ...

2018-04-21 17:27:46 136

原创 645. Set Mismatch python

集合S最初包含从1到n的数字。 但不幸的是,由于数据错误,集合中的其中一个数字被复制到集合中的另一个数字,导致重复一个数字并丢失另一个数字。给定一个数组nums,表示错误发生后该数据集的数据状态。 你的任务是首先发现出现两次的数字,然后找到丢失的数字。 以数组的形式返回它们。class Solution(object): def findErrorNums(self, nums): ...

2018-04-21 17:10:34 247

原创 720. Longest Word in Dictionary python

class Solution(object): def longestWord(self, words): """ :type words: List[str] :rtype: str """ wset = set(['']) ans = '' for word in sorte...

2018-04-20 21:29:35 195

原创 leetcode 811. Subdomain Visit Count python

class Solution(object): def subdomainVisits(self, cpdomains): """ :type cpdomains: List[str] :rtype: List[str] """ ant = collections.Counter() for d...

2018-04-20 21:14:56 255

原创 leetcode 389. Find the Difference python

给定两个字符串s和t,都只包含小写字母。字符串t由字符串s打乱顺序并且额外在随机位置添加一个字母组成。寻找t中新增的那个字母。keys()以列表形式返回一个字典所有的键 , pop()用于移除列表中的某个元素(默认最后一个),并返回该值class Solution(object): def findTheDifference(self, s, t): """ ...

2018-04-16 09:52:28 144

原创 leetcode 414. Third Maximum Number python

给定一个非空数组,返回此数组中的第三个最大数。 如果不存在,则返回最大数量。 时间复杂度必须在O(n)中。class Solution(object): def thirdMax(self, nums): """ :type nums: List[int] :rtype: int """ a = b = c ...

2018-04-14 15:47:15 139

原创 leetcode 766. Toeplitz Matrix python

如果从左上角到右下角的每个对角线具有相同的元素,则矩阵是Toeplitz。现在给出一个M×N矩阵,当且仅当矩阵是Toeplitz时才返回True。class Solution(object): def isToeplitzMatrix(self, matrix): """ :type matrix: List[List[int]] :rtyp...

2018-04-14 15:41:27 676

原创 leetcode 746. Min Cost Climbing Stairs python

有n级台阶,每次可以向上跳1至2级,上台阶的总花费为sum(cost[i]), i为所有踩过的台阶。可以从索引为0的步骤开始,或者从索引为1的步骤开始求最小花费。因为每次可以走1层或者2层,并且可以从0或者从1开始,所以可以得到dp[0]为0,dp[1]为0。从2开始,dp[i]可以由通过dp[i-2]走2层或者通过dp[i-1]走一层到达,而这i-2和i-1层所要花费的值分别为cost[i-2]...

2018-04-14 15:38:02 317

原创 leetcode 724. Find Pivot Index python

给定一个整数数组nums,编写一个返回该数组的“pivot”索引的方法。我们将pivot索引定义为索引左边的数字总和等于索引右边数字总和的索引。如果不存在这样的索引,我们应该返回-1。 如果有多个透视索引,则应返回最左侧的索引。class Solution(object): def pivotIndex(self, nums): """ :type nums...

2018-04-14 15:26:43 335

原创 LeetCode 695. Max Area of Island

给定二维格子grid,上下左右相邻的1组成岛屿,求岛屿的最大面积。class Solution(object): def maxAreaOfIsland(self, grid): """ :type grid: List[List[int]] :rtype: int """ m = len(grid) ...

2018-04-13 16:06:20 82

原创 leetcode 717. 1-bit and 2-bit Characters python

01序列由三种成分构成:10, 11, 0求序列经过解析后,最后一个成分是否为0class Solution(object): def isOneBitCharacter(self,bits): length = len(bits) c = 1 while c &lt;length: if c == length - ...

2018-04-13 15:45:07 278 1

原创 leetcode 674. Longest Continuous Increasing Subsequence python

给定无序整数数组,计算最长连续递增子序列的长度class Solution(object): def findLengthOfLCIS(self, nums): """ :type nums: List[int] :rtype: int """ count = 1 maxcount = 1 ...

2018-04-13 15:34:28 102

原创 leetcode 665. Non-decreasing Array python

给定包含n个整数的数组,至多改变其中一个数字,判断数组是否可以变为非递减有序发现nums[i]&gt;nums[i-1]时,对数组的调整只用考虑两种情况,1.将nums[i]置换为nums[i-1] ,2.将nums[i-1]置换为nums[i]break提前结束了整个循环,continue结束了本轮循环,并开始下一轮循环。class Solution(object): def check...

2018-04-12 16:41:39 167

原创 leetcode 661. Image Smoother python

给定表示图像灰度的二维整数矩阵M,您需要设计一个更平滑的图像,使每个单元格的灰度级成为所有8个周围单元格及其自身的平均灰度级(舍入)。 如果一个细胞的周围细胞少于8个,则尽可能多地使用。使用copy函数创建一个数组,再从[0][0]开始对数组元素重新填入。from copy import deepcopy as copyclass Solution(object): def image...

2018-04-12 16:09:44 430

原创 leetcode 628. Maximum Product of Three Numbers python

给定一个整数数组,输出最大的三个数字的乘积考虑有负数的情况class Solution(object): def maximumProduct(self, nums): """ :type nums: List[int] :rtype: int """ nums.sort() return ma...

2018-04-12 15:32:45 221

原创 leetcode 605. Can Place Flowers python

给定数组flowerbed表示一个花床,0表示位置为空,1表示位置非空。花不能相邻种植,即不能出现相邻的1。给定想要种植的花朵数目n,判断是否可以满足要求。使用continue跳出循环class Solution(object): def canPlaceFlowers(self, flowerbed, n): """ :type flowerbed: Li...

2018-04-12 15:27:07 324

原创 leetcode 643. Maximum Average Subarray I python

给定一个由n个整数组成的数组,找到具有最大平均值的给定长度为k的连续子数组。 你需要输出最大的平均值。滑动窗口法class Solution(object): def findMaxAverage(self, nums, k): """ :type nums: List[int] :type k: int :rtype: fl...

2018-04-12 15:12:29 373

原创 leetcode 581. Shortest Unsorted Continuous Subarray python

给定一个整数数组,你需要找到一个连续的子数组,如果你只按升序对这个子数组进行排序,那么整个数组也将按照升序排序。你需要找到最短的这种子阵列并输出它的长度。排序后比对不相同的数段class Solution(object): def findUnsortedSubarray(self, nums): """ :type nums: List[int] ...

2018-04-11 15:59:05 365

原创 leetcode 566. Reshape the Matrix python

给定二维矩阵nums,将其转化为r行c列的新矩阵。若无法完成转化,返回原矩阵。直接调用numpyimport numpy as npclass Solution(object): def matrixReshape(self, nums, r, c): try: return np.reshape(nums, (r, c)).tolist() ...

2018-04-11 15:48:06 102

原创 leetcode 561. Array Partition I python

给定一个2n整数的数组,你的任务是把这些整数分成n对,使得min(ai, bi)从i到n的和尽可能大。虽然不喜欢排序,但是这道题排序会有最高效率class Solution(object): def arrayPairSum(self, nums): """ :type nums: List[int] :rtype: int ...

2018-04-11 15:46:01 76

原创 leetcode 532. K-diff Pairs in an Array python

给定一个整数数组nums,以及一个整数k,找出其中所有差恰好为k的不重复数对。class Solution(object): def findPairs(self, nums, k): """ :type nums: List[int] :type k: int :rtype: int """ ...

2018-04-11 15:41:16 99

原创 leetcode 485. Max Consecutive Ones python

给定一个二进制数组,查找此数组中连续1的最大数目。class Solution(object): def findMaxConsecutiveOnes(self, nums): """ :type nums: List[int] :rtype: int """ count = 0 maxcoun...

2018-04-11 15:33:26 82

原创 leetcode 448. Find All Numbers Disappeared in an Array python

给定一个整数数组,其中1≤a[i]≤n(n =数组的大小),一些元素出现两次,其他元素出现一次。寻找所有[1,n]中没有出现在数组中的元素方法1:class Solution(object): def findDisappearednumbers(self,nums): return list(set(range(1,len(nums)+1)) - set(nums))方法...

2018-04-09 22:46:58 65

空空如也

空空如也

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

TA关注的人

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