E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
leetcode-初级算法
C实现
LeetCode-
>Roman to Integer
Givenaromannumeral,convertittoaninteger.Inputisguaranteedtobewithintherangefrom1to3999.罗马字符串转换为int intromanToInt(char*s){ intmap[256]={0}; map['I']=1; map['V']=5; map['X']=10; map['L']=50; map['C']=10
liutianshx2012
·
2015-06-11 11:00
C实现
LeetCode-
>Integer to Roman
Givenaninteger,convertittoaromannumeral.Inputisguaranteedtobewithintherangefrom1to3999.将一个整形转换为罗马字符 int范围(1-3999)// //IntegerToRoman.c //Algorithms // //CreatedbyTTcon15/6/11. //Copyright(c)2015年TTc.A
liutianshx2012
·
2015-06-11 11:00
C实现
LeetCode-
>Reverse Integer
Reversedigitsofaninteger.Example1: x=123,return321Example2: x=-123,return-321反转整形主要是注意边界条件1: 如果整数的最后一位为0,应该输出什么?例如,如100。2: 逆转整数可能溢出;假设输入是一个32位整数,然后反向1000000003溢出// //PalindromeNumber.c //Algorithms /
liutianshx2012
·
2015-06-11 10:00
C实现
LeetCode-
>Palindrome Number
Determinewhetheranintegerisapalindrome.Dothiswithoutextraspace.判断一个整形是不是回文,不能使用额外的空间 扩展:(判断一个字符串是不是回文 ;一个单链表是不是回文;一个栈是不是回文)// //PalindromeNumber.c //Algorithms // //CreatedbyTTcon15/6/6. //Copyright(c
liutianshx2012
·
2015-06-11 10:00
C实现
LeetCode-
>Longest Palindromic Substring
Givenastring S,findthelongestpalindromicsubstringin S.Youmayassumethatthemaximumlengthof S is1000,andthereexistsoneuniquelongestpalindromicsubstring.回文,英文palindrome,指一个顺着读和反过来读都一样的字符串,比如madam、我爱我最长回文子
liutianshx2012
·
2015-06-06 18:00
C实现
LeetCode-
>Longest Substring Without Repeating Characters
Givenastring,findthelengthofthelongestsubstringwithoutrepeatingcharacters.Forexample,thelongestsubstringwithoutrepeatinglettersfor"abcabcbb"is"abc",whichthelengthis3.For"bbbbb"thelongestsubstringis"b"
liutianshx2012
·
2015-06-06 16:00
C实现
LeetCode-
>Add Two Numbers
Youaregiventwolinkedlistsrepresentingtwonon-negativenumbers.Thedigitsarestoredinreverseorderandeachoftheirnodescontainasingledigit.Addthetwonumbersandreturnitasalinkedlist.Input: (2->4->3)+(5->6->4)Ou
liutianshx2012
·
2015-06-04 15:00
C实现
LeetCode-
> TwoSum
Givenanarrayofintegers,findtwonumberssuchthattheyadduptoaspecifictargetnumber.ThefunctiontwoSumshouldreturnindicesofthetwonumberssuchthattheyadduptothetarget,whereindex1mustbelessthanindex2.Pleasenote
liutianshx2012
·
2015-06-04 15:00
*
LeetCode-
Sum Root to Leaf Numbers
这个题一开始一直想从叶子开始加,后来发现从root向下走比较方便。递归函数传一个记录到达当前节点的和。recursive:publicclassSolution{ publicintsumNumbers(TreeNoderoot){ returnsum(root,0); } publicintsum(TreeNoderoot,intsumNow){ if(root==null) return0;
bsbcarter
·
2015-03-08 08:00
LeetCode-
Pascal's Triangle
1.TheuseofListofListinJava在声明时,List和ArrayList必须每一层对应,就是>list=newArraylist>()是不对的
bsbcarter
·
2015-02-04 11:00
LeetCode
ArrayList
珍爱网算法总监黄鑫:用算法帮人们找到幸福
他在豆瓣算法组做了三年的算法,从
初级算法
工程师一直到后来的算法组TechLeader。黄鑫现在加入了珍爱网,他希望能在这里
图灵访谈
·
2014-12-23 00:00
图灵访谈
算法
LeetCode-
(2) Median of Two Sorted Arrays
问题描述:TherearetwosortedarraysAandBofsizemandnrespectively.Findthemedianofthetwosortedarrays.TheoverallruntimecomplexityshouldbeO(log(m+n)).思路:1. 在2个有序的数组中找中值,那么可以把2个数组合并,然后直接去中值就可以,时间复杂度为O(m+n)/2。因为题目
notlcry
·
2014-12-12 08:00
LeetCode
binaySearch
LeetCode-
(1) Two Sum
问题地址:https://oj.leetcode.com/problems/two-sum/问题描述:Givenanarrayofintegers,findtwonumberssuchthattheyadduptoaspecifictargetnumber.ThefunctiontwoSumshouldreturnindicesofthetwonumberssuchthattheyaddupto
notlcry
·
2014-12-05 11:00
LeetCode
编程基础
初级算法
-排列组合
排列组合是组合学最基本的概念。所谓排列,就是指从给定个数的元素中取出指定个数的元素进行排序。组合则是指从给定个数的元素中仅仅取出指定个数的元素,不考虑排序。排列组合的中心问题是研究给定要求的排列和组合可能出现的情况总数。 publicclassMyTest{ publicstaticvoidmain(String[]args){ char[]buf={'1','2','3'}; perm(buf
u012814441
·
2014-11-29 00:00
【编程之美】中的美中不足,谈谈我的理解
拿到书本后,看了一下,里面的题目并不是太难,都是
初级算法
,或者有些根本就不用到算法。在二分查找的知识点中,还是比较新颖的,看来我写的二分一直存在bug啊。
superMarss
·
2014-09-11 15:00
二分查找
优化
算法
编程之美
ACM
【算法与数据结构】一道检测inversion count的
初级算法
(转载请注明出处:http://blog.csdn.net/buptgshengod)1.题目 这是一道检测inversioncount的算法。它将检测输入序列中反序输入的个数,即检测其中有几对A[i]>A[j],i=list[j]){ }else{t=list[j+1];list[j+1]=list[j];list[j]=t;number++;}}}System.out.printl
gshengod
·
2013-12-14 19:00
数据结构
算法
ACM
初级算法
ACM的算法(觉得很好,有层次感)OJ上的一些水题(可用来练手和增加自信)(poj3299,poj2159,poj2739,poj1083,poj2262,poj1503,poj3006,poj2255,poj3094)[size=5][b]初期:[/b][/size]一.基本算法: (1)枚举.(poj1753,poj2965) (2)贪心(poj1328,poj2109,poj
hcy0727
·
2012-05-15 22:00
数据结构
c
算法
(整理中)利用定义模板类的一些
初级算法
*在第七周的实验报告中的第三个任务,有用到构建定义模板的知识,在上半学期中学到的一些基础算法,或许在下半年的程序语言中会用到,就去查找了一下,目前只觉得这些眼熟些,就总结一下。如果在看到会在整理上。整理的很粗糙。//选择法对数组排序的函数模板 template voidselectsort(Tarr[],intsize) { Ttemp; inti,j; for(i=0;iarr[j]
ww1248694689
·
2012-04-03 21:00
算法
search
Class
语言
任务
C语言经典算法:如何较快的分解质因数
初级算法
:#include #include #include intmain() { intn,i; scanf("%d",&n); printf("%d=",n); for(i=2;i #include
shimachao
·
2012-03-11 15:00
5岁的滢滢
5岁的滢滢,是小妹的女儿,2011年幼儿园暑假和外婆一起从福建来广州,小妹的目的是来穗能学习
初级算法
和英语,不过来广州吃和玩才是主调,学习是次要。
fjssharpsword
·
2011-07-30 04:00
游戏
工作
算法
作业
图论
初级算法
图遍历算法 ---- DFS & BFS... public class GraphTraveler { LinkedList<Integer> open = new LinkedList<Integer>(); public void bfs(Graph g, int start) { int n = g.ge
superhack
·
2010-03-10 19:00
算法
J#
上一页
49
50
51
52
53
54
55
56
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他