码迷,mamicode.com
首页 >  
搜索关键字:leetcode happy numbe    ( 36157个结果)
Leetcode: Longest Palindromic Substring. java
Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa...
分类:编程语言   时间:2014-06-02 09:22:03    阅读次数:328
LeetCode: String to Interger (atoi) 题解
Implementatoito convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a challenge, please do not see below and ...
分类:其他好文   时间:2014-06-02 08:51:43    阅读次数:233
Leetcode: 06/01
今天完成了三道题目,总结一下:1: Length of last word(细节实现题)此题有一些细节需要注意(比如 “a_ _” 最后一个单词是a, 而不是遇到空格就直接算成没有),别的基本就是模拟了。 1 class Solution { 2 public: 3 int lengthOf...
分类:其他好文   时间:2014-06-02 00:28:43    阅读次数:326
【leetcode】N-queens II
问题: 返回N皇后问题解的个数。 分析: 详见 N-queens 实现: bool nextPermutation(vector &num) { int i = num.size() - 1; while (i >= 1) { if(num[i] > num[i - 1]) { --i; int ii = num.size() - 1; while (i...
分类:其他好文   时间:2014-06-01 18:24:45    阅读次数:398
【leetcode】N-queens
问题: The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two queens attack each other. Given an integer n, return all distinct solutions to the n-queens...
分类:其他好文   时间:2014-06-01 18:08:28    阅读次数:334
leetcode Reverse Nodes in k-Group
递归一下 /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class Solution { public: Li...
分类:其他好文   时间:2014-06-01 17:35:40    阅读次数:406
leetcode -- 3 sum
3-sum    题目描述: Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. 题目要求: Elements...
分类:其他好文   时间:2014-06-01 17:31:27    阅读次数:471
LeetCode: Add Two Numbers 题解
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ...
分类:其他好文   时间:2014-06-01 17:05:44    阅读次数:296
【leetcode】 Text Justification
问题: 给定一个字符串数组words,一个整数L,将words中的字符串按行编辑,L表示每行的长度。 要求: 1)每个单词之间至少是有一个空格隔开的。 2)最后一行每个单词间只间隔一个空格, 最后一个单词后不足L长度的用空格填充。 3)除最后一行外,其他行进行填充长度的空格要均分,不能均分的,将余数代表的空格数依次填充在行左。 For example, words: ["Th...
分类:其他好文   时间:2014-06-01 15:43:03    阅读次数:297
【leetcode】Substring with Concatenation of All Words
题目: 给定一个字符串S,一个字符串数组L,找出S中所有这样的子串起点,该子串包含L中的所有元素。 说明: 1)L中存在重复的元素 2)子串不允许间断,即子串从开始到找全L中的所有元素之前,子串中不允许包含L以外的东西,而且,即使当前处理的子串是L中含有的,但是前面已经找够了,这个多余的也是不合法的,若此时还有L中的其他元素没找到,从这个起点开始也是不成功的。 3)L在S中出现的...
分类:其他好文   时间:2014-06-01 12:54:53    阅读次数:192
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!