
python算法
文章平均质量分 77
做只幽默的程序袁
IT理工男
展开
-
数组根据差值分类
给开头加上一句话吧,不然不好看,哈哈昨天晚上(2018.2.7)的程序是根据差值将一个数组划分为若干数组给输出出来#-*-:Coding:UTF-8-*-#Author:YuanTian#Date:2018/2/7 21:36PM#Classify a big array as some small arrays#by the value difference(<=1) of...原创 2018-02-07 22:40:53 · 977 阅读 · 0 评论 -
leetcode题目之求数值下标问题
这道题意思是给出一个有序的列表,里面的元素类型都是整型,然后给定一个数字,如果这个数字在这个列表中出现了,那就返回这个数字在这个列表中的下标(从0开始),如果这个数字没有出现,那就返回插入这个数字到这个列表中,此时这个数字应该有的下标值。看下题目描述:Given a sorted array and a target value, return the index if the targe...原创 2018-12-13 03:39:13 · 406 阅读 · 0 评论 -
Leetcode题目之求字符串列表的最大前缀子串
题目描述如下:Write a function to find the longest common prefix string amongst an array of strings.If there is no common prefix, return an empty string "".Example 1:Input: ["flower","flow","flight"]...原创 2018-12-10 23:43:08 · 947 阅读 · 0 评论 -
Leetcode题目之求字符串中子串位置指针索引
首先来看下这个题目的问题:简言之就是要求一个字符串中,某一个子串它的下标,如果有,则返回这个子串首次出现的下标,如果没有,就返回-1,下面是原题:Implement strStr().Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack....原创 2018-12-12 01:13:19 · 682 阅读 · 0 评论 -
python旋转图片
今天在处理图片做模型测试的时候,发现如果对于人脸的检测,当图片的角度发生变化,比如人的照片是倒置的就会对精度产生影响,所以对于初始图像的处理是必要的,需要处理图像旋转,这样在数据增强等领域也都有很多的应用。我使用python来进行这个操作,代码如下:import cv2import imutilsimage = cv2.imread('/home/yuantian/Downloads...原创 2019-03-28 14:48:37 · 14536 阅读 · 2 评论