码迷,mamicode.com
首页 >  
搜索关键字:problems    ( 6275个结果
【SPOJ】694. Distinct Substrings
http://www.spoj.com/problems/DISUBSTR/题意:求字符串不同子串的数目。#include using namespace std;const int N=1005;void sort(int *x, int *y, int *sa, int n, int m) { ...
分类:其他好文   时间:2015-01-13 14:09:04    阅读次数:126
Two Sum
https://oj.leetcode.com/problems/two-sum/Given an array of integers, find two numbers such that they add up to a specific target number.The function t...
分类:其他好文   时间:2015-01-13 14:07:07    阅读次数:130
Remove Duplicates from Sorted List
https://oj.leetcode.com/problems/remove-duplicates-from-sorted-list/Given a sorted linked list, delete all duplicates such that each element appear on...
分类:其他好文   时间:2015-01-13 14:03:09    阅读次数:114
Linked List Cycle
https://oj.leetcode.com/problems/linked-list-cycle/Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using ext...
分类:其他好文   时间:2015-01-13 13:55:51    阅读次数:193
Reverse Words in a String
https://oj.leetcode.com/problems/reverse-words-in-a-string/Given an input string, reverse the string word by word.For example,Given s = "the sky is bl...
分类:其他好文   时间:2015-01-13 13:54:37    阅读次数:135
[LeetCode][Python]Longest Palindromic Substring
# -*- coding: utf8 -*-'''__author__ = 'dabay.wang@gmail.com'https://oj.leetcode.com/problems/longest-palindromic-substring/Given a string S, find the ...
分类:编程语言   时间:2015-01-13 01:21:57    阅读次数:285
[Leetcode] 15 - 3Sum
原题链接:https://oj.leetcode.com/problems/3sum/ 经典3sum题,不过要注意这里的去重,去重是给原来这道题的基本形式加的难点。 1. 数组如果大小小于3,那就没有任何结果。 2. 将数组排序 3. 然后循环数组,每次都选取i所在的当前值为第一个结果,然后选取left = i + 1和right = size - 1。则问题变为num[left]...
分类:其他好文   时间:2015-01-12 17:39:26    阅读次数:174
[Leetcode] 13 - Roman to Integer
原题链接:https://oj.leetcode.com/problems/roman-to-integer/ 比较简单的题,代码应该还可以稍微优化,更generic一些。 class Solution { public: int romanToInt(string s) { if (s.size() == 0) return 0; ...
分类:其他好文   时间:2015-01-12 16:38:48    阅读次数:122
[Leetcode] 12 - Integer to Roman
原题链接:https://oj.leetcode.com/problems/integer-to-roman/ 这题也是简单题,重点是要维持一个罗马数字的数组,然后每位计算时候,则数组往后扫2位,使用同样的计算方式得出当前位的罗马表示。 class Solution { public: string intToRoman(int num) { char ...
分类:其他好文   时间:2015-01-12 16:36:48    阅读次数:170
[LeetCode][Python]Longest Substring Without Repeating Characters
# -*- coding: utf8 -*-'''__author__ = 'dabay.wang@gmail.com'https://oj.leetcode.com/problems/longest-substring-without-repeating-characters/Given a st...
分类:编程语言   时间:2015-01-12 01:36:33    阅读次数:255
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!