码迷,mamicode.com
首页 >  
搜索关键字:leetcode 19    ( 34993个结果
【LeetCode】- Length of Last Word(最后一个单词的长度)
[ 问题: ] Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the last word does not exist, return 0. [...
分类:其他好文   时间:2014-07-22 23:01:35    阅读次数:331
【LeetCode】- Search Insert Position(查找插入的位置)
[ 问题: ] Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order. You may assume no duplicates in th...
分类:其他好文   时间:2014-07-22 23:01:15    阅读次数:270
Leetcode: Remove Elements
一次性通过的,比较顺利,从读题到编写到检查到通过,14分50秒,我在不断进步中,相信经过一段时间联系,这种题可以一眼就写出来,不超过5分钟。这道题应该说方法跟 Remove Duplicates from sorted Array挺类似的My Solution: 1 public class Sol...
分类:其他好文   时间:2014-05-02 12:56:10    阅读次数:260
LeetCode - Trangle
这道题,采用动态规划算法。from top to down,把到每个节点的最小路径和都求出来。下面是AC代码: 1 /** 2 * Given a triangle, find the minimum path sum from top to bottom. 3 * Each ...
分类:其他好文   时间:2014-05-02 12:19:23    阅读次数:382
leetcode: Search a 2D Matrix
Write an efficient algorithm that searches for a value in anmxnmatrix. This matrix has the following properties:Integers in each row are sorted from l...
分类:其他好文   时间:2014-05-02 10:41:53    阅读次数:267
Leetcode: Plus One
少数次通过 1 public class Solution { 2 public int[] plusOne(int[] digits) { 3 int[] carry=new int[digits.length+1]; 4 int[] results=new i...
分类:其他好文   时间:2014-05-02 08:23:11    阅读次数:271
Leetcode: Length of Last Word
许多次通过,主要是没有考虑到这种情况:“A C ”结尾有多重空格的情况。 1 public class Solution { 2 public int lengthOfLastWord(String s) { 3 int j, k; 4 if(s == nu...
分类:其他好文   时间:2014-05-02 08:21:00    阅读次数:300
Jump Game
leetcode, Jump Game , 递推求解...
分类:其他好文   时间:2014-05-02 05:10:22    阅读次数:181
[leetcode] Best Time to Buy and Sell Stock
Say you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to complete at most one transaction (ie...
分类:其他好文   时间:2014-05-02 00:37:20    阅读次数:349
Leetcode: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? 刚开始没有思路,但是自己举了几个简单的栗子才看出规律:需要一圈儿一圈儿的变换位置。有两层for循环:外...
分类:其他好文   时间:2014-05-01 18:33:34    阅读次数:359
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!