- 博客(14)
- 资源 (3)
- 收藏
- 关注
原创 题目1256:找出两个只出现了一次的数字
题目描述:一个整型数组里除了两个数字之外,其他的数字都出现了两次。请写程序找出这两个只出现一次的数字。输入:输入的第一行包括一个整数N(1接下来的一行包括N个整数。输出:可能有多组测试数据,对于每组数据,找出这个数组中的两个只出现了一次的数字。输出的数字的顺序为从小到大。样例输入:62 3 9 3 7 2 样
2014-05-27 23:54:51 824
原创 题目1254:N皇后问题(DFS)
题目描述:N皇后问题,即在N*N的方格棋盘内放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在同一斜线上。因为皇后可以直走,横走和斜走如下图)。你的任务是,对于给定的N,求出有多少种合法的放置方法。输出N皇后问题所有不同的摆放情况个数。输入:输入包含多组测试数据。每组测试数据输入一个整数n(3输出:
2014-05-27 23:20:50 993
原创 题目1251:序列分割(DFS+剪枝)
题目描述:一个整数数组,长度为n,将其分为m份,使各份的和相等,求m的最大值 比如{3,2,4,3,6} 可以分成{3,2,4,3,6} m=1; {3,6}{2,4,3} m=2 {3,3}{2,4}{6} m=3 所以m的最大值为3。输入:存在多组数据,每组数据一定行为一个正整数n(n输出:输出最大值m。样例输入:
2014-05-27 22:57:57 1030
原创 LeetCode Median of Two Sorted Arrays (DFS)
There are two sorted arrays A and B 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)).Have you been asked
2014-05-15 15:34:12 692
原创 LeetCode Word Ladder(BFS)
Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that:Only one letter can be changed at a timeEach intermediate word m
2014-05-12 20:54:36 794
原创 LeetCode Reverse Words in a String
Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".click to show clarification.Clarification:What constitutes
2014-05-12 19:15:20 579
原创 LeetCode Word Break (dp)
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",dict = ["leet"
2014-05-10 13:02:22 611
原创 LeetCode Word Break(DFS)
Given a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more dictionary words.For example, givens = "leetcode",dict = ["leet"
2014-05-10 12:54:16 882
原创 UVa10464 - Big Big Real Numbers
Problem B:Big Big Real NumbersTime Limit: 1 secondMemory Limit: 32 MBAztec warriors are very good at math (Sssh! It�s a secret information :). As an Aztec, little Ahuitzotl h
2014-05-09 23:35:04 1161
原创 题目1252:回文子串
题目描述:输入一个字符串,输出该字符串中对称的子字符串的最大长度。比如输入字符串“google”,由于该字符串里最长的对称子字符串是“goog”,因此输出4。输入:存在多组数据,每组数据一行字符串,长度不大于100。输出:输出回文子串的最大长度。样例输入:google样例输出:4
2014-05-01 11:01:18 644
原创 LeetCode Evaluate Reverse Polish Notation(用栈来计算后缀表达式)
Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples: ["2", "1",
2014-05-01 09:15:27 695
Ubuntu Linux实用学习教程.pdf
2009-09-11
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人