关闭

14. Longest Common Prefix-python

Write a function to find the longest common prefix string amongst an array of strings.思路 随机选取一个字符作为最长公共前缀 遍历这个前缀的每个字符 若所有的字符串都含有这个字符,则最长公共前缀指针前进1 Codeclass Solution(object): def longestCommonPrefix...
阅读(158) 评论(0)

12. Integer to Roman-python

Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.Codeclass Solution(object): def intToRoman(self, num): """ :type num: int...
阅读(104) 评论(0)

python-list与set相互转换时的一个注意事项

list初始化,里面的元素是set,n1={"","I","II","III","IV","V","VI","VII","VIII","IX"} #1~9 n10={"","X","XX","XXX","XL","L","LX","LXX","LXXX","XC"} #10~90 n100={"","C","CC","CCC","CD","D","DC","DCC","DCCC","CM"} #10...
阅读(251) 评论(0)

python与C, C++,C#一个计算精度的区别

python计算精度问题,如下所示,会自动保留精度 但在C, C++,C#中情况就不尽然,是的结果为01/(Math.Pow(10,3) = 0...
阅读(392) 评论(0)

9. Palindrome Number-python

Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints: Could negative integers be palindromes? (ie, -1)If you are thinking of converting the intege...
阅读(337) 评论(0)

7. Reverse Integer-python

Reverse digits of an integer.Example1: x = 123, return 321 Example2: x = -123, return -321Note: The input is assumed to be a 32-bit signed integer. Your function should return 0 when the reversed integ...
阅读(344) 评论(0)

图像处理中,outlier和inlier分别指什么?

可以这样理解: 如图所示,给定一些点(红+绿+黑)要求用这些数据点拟合椭圆。 以ransac拟合椭圆为例,可以看出,黄色椭圆为拟合结果, 红色点是由ransac随机选择用来拟合的数据点 黑色点是除红色点外距离椭圆距离小于某一阈值的点,而绿色点是距离椭圆距离大于这一阈值的点 那么,红色+黑色点即为内点,而绿色点为外点: RANSAC为Random Sample Consensus的...
阅读(420) 评论(0)

4. Median of Two Sorted Arrays-python

There are two sorted arrays nums1 and nums2 of size m and n respectively.Find the median of the two sorted arrays. The overall run time complexity should be O(log (m+n)).Example 1: nums1 = [1, 3] nums2...
阅读(272) 评论(0)

3.Longest Substring Without Repeating Characters-python

Given a string, find the length of the longest substring without repeating characters.Examples:Given “abcabcbb”, the answer is “abc”, which the length is 3.Given “bbbbb”, the answer is “b”, with the le...
阅读(258) 评论(0)

1. Two Sum-python

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 the same ele...
阅读(383) 评论(0)

User32-SendInput模拟数字键盘发送到文本框-32位和64位兼容问题

原来的Input结构体为如下,导致只能在32位下运行,using System; using System.Runtime.InteropServices; using System.Drawing;namespace CAXA.MES.ScreenKeyboard { [StructLayout(LayoutKind.Sequential)] internal struct MOU...
阅读(184) 评论(0)

入门-误差逆传播算法

定义误差逆传播算法(backpropagation BP算法)是迄今最成功的的神经网络算法。显示任务中使用神经网络时,大多是在使用BP算法进行训练。不仅适用于多层前馈神经网络,还可以用于其他类型的神经网络,训练递归。BP算法如下图的神经网络,有一隐式层,ll个神经元组成的输出层。 重点介绍标准的BP算法,也就是只考虑单个输入神经元节点的误差逆传播,研究的输入例为(xk,yk)(x_k,y_k),假...
阅读(315) 评论(0)

入门-神经元模型,感知机与多层网络

M-P模型1943年,McCulloch and Pitts抽象出了“M-P神经元模型”,神经元接受到来自nn个其他神经元传递过来的输入信号,通过带权重的值连接传递,神经元接受到的总输入值与神经元的阈值进行比较,通过激活函数(activation function)处理输出。激活函数理想中的激活函数如下图所示的阶跃函数,它将输入值映射为输出值0 (对应于神经元抑制)或 1(对应于神经元兴奋)。...
阅读(198) 评论(0)

48. Rotate Image

原题You are given an n x n 2D matrix representing an image.Rotate the image by 90 degrees (clockwise).Follow up: Could you do this in-place?代码实现算法思想: public class Solution { //This is in...
阅读(192) 评论(0)

图像顺时针步进1个像素点的算法

矩阵步进1的算法public void Rotate(int[,] matrix) { int n = matrix.GetUpperBound(0) + 1; int loop = n >> 1; for (int i = 0; i < loop; i++) {...
阅读(176) 评论(0)

Linux-ubuntu常用最基本命令

bash bash是最常见的Shell,全名为 Bourne Again Shell。 xiaoming@computername:~$ @之前的,是当前用户的用户名; @后面,“:”前面是计算机名; “:”后面,是当前所在目录; 在“$”后面可以输入命令。 echo $PATH 运行这个命令,可以查看环境变量PATH到底是什么。 man ifconfig 需要帮助...
阅读(103) 评论(0)

34. Search for a Range

原题Given an array of integers sorted in ascending order, find the starting and ending position of a given target value.Your algorithm’s runtime complexity must be in the order of O(log n).If the target...
阅读(218) 评论(0)

32. Longest Valid Parentheses

栈的典型应用。能想到栈,但是能想到Push字符索引,真的不是很容易(这道题一般的想法是存储‘(’ ‘)’这些符号)。 原题 Given a string containing just the characters ‘(’ and ‘)’, find the length of the longest valid (well-formed) parentheses substring....
阅读(462) 评论(0)

.NET-数据拖动

使用场景选中左侧树的某个节点,在右侧表格中显示此节点下的数据list,如果想拖动其中一条数据到另一个树节点下。该如何操作呢。实现代码添加grid的MouseDown事件: private void gridMouseDown(object sender, MouseEventArgs e) { if (e.Button...
阅读(150) 评论(0)

[置顶] leetcode已完成题目索引

算法研究的重要性 2 leetcode leetcode是面试算法真题,囊括了常用算法思想和经典题目,是算法入门和提升的好材料。我每天都至少训练一个题目,锻炼自己的逻辑思维和写算法的严密性。 3 标签和题目 常用标签 已完成题目列表 ID Tags Solution 1 Array;HashTable; Two Sum 2 Lin...
阅读(902) 评论(0)
46条 共3页1 2 3 下一页 尾页
    Leetcode Solutions in Github

    Click me

    Leetcode solutions in Github, including tags: Array, HashTable, Stack, Queue, LinkedList, Tree, Graph,...

    leetcode-manager

    Click me

    Current Leetcode manager: it's used by Entity Framework, WinForms, Sql Server to manage leetcode questions that we have done. Functions include tags creation, revise and deletion, and questions creation, edit and deletion.

    个人资料
    • 访问:126184次
    • 积分:5037
    • 等级:
    • 排名:第5927名
    • 原创:311篇
    • 转载:0篇
    • 译文:0篇
    • 评论:53条
    博客专栏