IT大道IT大道

首页 > TAG信息列表 > LeetCode

  • 119. Pascal's Triangle II

    119. Pascal's Triangle II

    Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [1,3,3,1].Note:Could you optimize your algorithm to use only O(k)...

    2017-07-24 itdadao 技术 10 ℃ 0
  • 118. Pascal's Triangle

    118. Pascal's Triangle

    Given numRows, generate the first numRows of Pascal's triangle.For example, given numRows = 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]]注意...

    2017-07-24 itdadao 技术 5 ℃ 0
  • leetcode — two-sum-iii-data-structure-design

    leetcode — two-sum-iii-data-structure-design

    import java.util.HashMap;
    import java.util.Map;

    /**
    * Source : https://oj.leetcode.com/problems/two-sum-iii-data-structure-design/
    *
    * Created by lverpeng o...

    2017-07-24 itdadao 技术 8 ℃ 0
  • LeetCode 73. Set Matrix Zeros(矩阵赋零)

    LeetCode 73. Set Matrix Zeros(矩阵赋零)

    Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.
    click to show follow up.
    Follow up:
    Did you use extra space?
    A str...

    2017-07-24 itdadao 技术 9 ℃ 0
  • 645. Set Mismatch

    645. Set Mismatch

    Problem statementThe set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to an...

    2017-07-24 itdadao 技术 7 ℃ 0
  • leetcode47. Permutations II

    leetcode47. Permutations II

    leetcode47. Permutations II
    题意:
    给定可能包含重复的数字的集合,返回所有可能的唯一排列。
    思路:
    这题全排列两种写法。

    用hash表记录已经visit的数字,虽然看起来很朴实,但是...

    2017-07-24 itdadao 技术 7 ℃ 0
  • 645. Set Mismatch 数组缺少的数字

    645. Set Mismatch 数组缺少的数字

    The set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to another number in t...

    2017-07-24 itdadao 技术 11 ℃ 0
  • leetcode[5]Longest Palindromic Substring(最长回文子串)

    leetcode[5]Longest Palindromic Substring(最长回文子串)

    Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.
    Example:



    Input: "babad"
    Output: "bab"
    Not...

    2017-07-23 itdadao 技术 11 ℃ 0
  • [LeetCode] Design Log Storage System 设计日志存储系统

    [LeetCode] Design Log Storage System 设计日志存储系统

    You are given several logs that each log contains a unique id and timestamp. Timestamp is a string that has the following format: Year:Month:Day:Hour:Minute:Sec...

    2017-07-23 itdadao 技术 11 ℃ 0
  • (Trie)LeetCode Weekly Contest 42 Q4  648. Replace Words

    (Trie)LeetCode Weekly Contest 42 Q4 648. Replace Words

    In English, we have a concept called root, which can be followed by some other words to form another longer word - let's call this word successor. For example,...

    2017-07-23 itdadao 技术 11 ℃ 0
  • [leetcode-646-Maximum Length of Pair Chain]

    [leetcode-646-Maximum Length of Pair Chain]

    You are given n pairs of numbers. In every pair, the first number is always smaller than the second number.
    Now, we define a pair (c, d) can follow another pair...

    2017-07-23 itdadao 技术 11 ℃ 0
  • [leetcode-645-Set Mismatch]

    [leetcode-645-Set Mismatch]

    The set S originally contains numbers from 1 to n. But unfortunately, due to the data error, one of the numbers in the set got duplicated to another number in t...

    2017-07-23 itdadao 技术 9 ℃ 0
  • LeetCode 66. Plus One(加1)

    LeetCode 66. Plus One(加1)

    Given a non-negative integer represented as a non-empty array of digits, plus one to the integer.
    You may assume the integer do not contain any leading zero, ex...

    2017-07-23 itdadao 技术 9 ℃ 0
  • LeetCode 64. Minimum Path Sum(最小和的路径)

    LeetCode 64. Minimum Path Sum(最小和的路径)

    Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path.
    Note: You...

    2017-07-23 itdadao 技术 9 ℃ 0
  • [LeetCode] Power of Three

    [LeetCode] Power of Three

    Given an integer, write a function to determine if it is a power of three.
    Follow up:
    Could you do it without using any loop / recursion?
    判断一个数是否是3的幂,...

    2017-07-22 itdadao 技术 13 ℃ 0
  • [LeetCode] Power of Two

    [LeetCode] Power of Two

    Given an integer, write a function to determine if it is a power of two.
    判断一个整数是否是2的幂。如果一个数是2的幂,则这个数的二进制表示中,最高位是1,其他位都是0。...

    2017-07-22 itdadao 技术 14 ℃ 0
  • 程序员面试金典--阶乘尾零

    程序员面试金典--阶乘尾零

    程序员面试金典--阶乘尾零

    题目描述


    请设计一个算法,计算n的阶乘有多少个尾随零。
    给定一个int n,请返回n的阶乘的尾零个数。保证n为正整数。
    测试样例:
    5
    返回:1



    其实就...

    2017-07-22 itdadao 技术 10 ℃ 0
  • LeetCode & Q283-Move Zeroes-Easy

    LeetCode & Q283-Move Zeroes-Easy

    Array Two Pointers
    Description:

    Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero ele...

    2017-07-22 itdadao 技术 13 ℃ 0
  • LeetCode 63. Unique Path II(所有不同路径之二)

    LeetCode 63. Unique Path II(所有不同路径之二)

    Follow up for "Unique Paths":
    Now consider if some obstacles are added to the grids. How many unique paths would there be?
    An obstacle and empty space is marked...

    2017-07-22 itdadao 技术 11 ℃ 0
  • leetcode76. Minimum Window Substring

    leetcode76. Minimum Window Substring

    leetcode76. Minimum Window Substring
    题意:
    给定字符串S和字符串T,找到S中的最小窗口,其中将包含复杂度O(n)中T中的所有字符。
    例如,

    S =“ADOBECODEBANC”

    T =“ABC”

    最小...

    2017-07-21 itdadao 技术 13 ℃ 0
  • 互联网技术笔试总通不过?leetcode刷对了么

    互联网技术笔试总通不过?leetcode刷对了么


    编者按:本文来自逆行求职(ID:nixingjihua)。
    对所有求职技术岗位的童鞋来说,有这么一样东西恐怕做梦都会梦到【Leetcode】,绕都绕不过去的程序员刷题神器。
    “哲学是世界...

    2017-07-21 itdadao 设计 13 ℃ 0
  • [LeetCode] Happy Number

    [LeetCode] Happy Number

    Write an algorithm to determine if a number is "happy".
    A happy number is a number defined by the following process: Starting with any positive integer, replac...

    2017-07-21 itdadao 技术 12 ℃ 0
  • [LeetCode] Longest Harmonious Subsequence

    [LeetCode] Longest Harmonious Subsequence

    We define a harmonious array is an array where the difference between its maximum value and its minimum value is exactly 1.
    Now, given an integer array, you nee...

    2017-07-21 itdadao 技术 12 ℃ 0
  • [LeetCode] Subtree of Another Tree

    [LeetCode] Subtree of Another Tree

    Given two non-empty binary trees s and t, check whether tree t has exactly the same structure and node values with a subtree of s. A subtree of s is a tree cons...

    2017-07-21 itdadao 技术 11 ℃ 0
  • LeetCode 59. Spiral Matrix II (螺旋矩阵之二)

    LeetCode 59. Spiral Matrix II (螺旋矩阵之二)

    Given an integer n, generate a square matrix filled with elements from 1 to n2 in spiral order.
    For example,
    Given n = 3,

    You should return the following matr...

    2017-07-21 itdadao 技术 14 ℃ 0
 10083    1 2 3 4 5 6 7 8 9 10 下一页 尾页
标签列表