IT大道IT大道

首页 > TAG信息列表 > LeetCode

  • LeetCode "455. Assign Cookies"

    LeetCode "455. Assign Cookies"

    Simple greedy thought .. satify each kid with minimum qualified cookie, from the least greedy kid..class Solution {public: int findContentChildren(vector<int...

    2017-01-24 itdadao 技术 5 ℃ 0
  • LeetCode "492. Construct the Rectangle"

    LeetCode "492. Construct the Rectangle"

    Idea is, among all factors of the int, we pick the two that is the closest pair. And searching from sqrt(area) is a better idea: https://discuss.leetcode.com/to...

    2017-01-24 itdadao 技术 13 ℃ 0
  • Leetcode: Sliding Window Median

    Leetcode: Sliding Window Median

    1 Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middl...

    2017-01-24 itdadao 技术 15 ℃ 0
  • Leetcode  20. Valid Parentheses

    Leetcode 20. Valid Parentheses

    一、题目要求:
    Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
    The brackets must close in t...

    2017-01-22 itdadao 技术 12 ℃ 0
  • LeetCode "488. Zuma Game" !

    LeetCode "488. Zuma Game" !

    I prefer shorter code, so this one:https://discuss.leetcode.com/topic/75448/memoization-c-solutionPlease note: we don't want to be too greedy - desperately shri...

    2017-01-22 itdadao 技术 15 ℃ 0
  • LeetCode "450. Delete Node in a BST"

    LeetCode "450. Delete Node in a BST"

    Yes the most concise solution is recursion.https://discuss.leetcode.com/topic/66165/very-concise-c-solution-for-general-binary-tree-not-only-bstHere is my non-r...

    2017-01-21 itdadao 技术 6 ℃ 0
  • LeetCode题目解答——第311到371题

    LeetCode题目解答——第311到371题

    老规矩,跳过需要付费的题目。题目是越来越不好做,我尽量把自己的思路写下来。



    371
    51.9%
    Easy


    368
    Largest Divisible Sub...

    2017-01-20 itdadao 技术 11 ℃ 0
  • LeetCode Repeated Substring Pattern

    LeetCode Repeated Substring Pattern

    原题链接在这里:https://leetcode.com/problems/repeated-substring-pattern/
    题目:
    Given a non-empty string check if it can be constructed by taking a substring of it...

    2017-01-20 itdadao 技术 16 ℃ 0
  • 263. 丑陋数 Ugly Number

    263. 丑陋数 Ugly Number

    Write a program to check whether a given number is an ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8...

    2017-01-19 itdadao 技术 21 ℃ 0
  • leetcode shell题目题解

    leetcode shell题目题解

    学习了一段时间的shell脚本,平常能查查资料写一些,今天发现了leetcode上除了算法还有shell问题,共有四道,有的也是参考了答案,哈哈,下面是题解了:

    Easy部分:

    195. Tenth Line

    Y...

    2017-01-19 itdadao 技术 12 ℃ 0
  • 413. 数组切片 Arithmetic Slices

    413. 数组切片 Arithmetic Slices

    A sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements is the same.For e...

    2017-01-18 itdadao 技术 19 ℃ 0
  • [leetcode] Best Time to Buy and Sell Stock I, II, III, with cool down

    [leetcode] Best Time to Buy and Sell Stock I, II, III, with cool down

    121. Best Time to Buy and Sell Stock





    Say you have an array for which the ith element is the price of a given stock on day i.
    If you were only permitted to...

    2017-01-18 itdadao 技术 19 ℃ 0
  • 419. 战船的数量 Battleships in a Board

    419. 战船的数量 Battleships in a Board

    Given an 2D board, count how many different battleships are in it. The battleships are represented with 'X's, empty slots are represented with '.'s. You may ass...

    2017-01-17 itdadao 技术 17 ℃ 0
  • LeetCode-148. Sort List

    LeetCode-148. Sort List

    148. Sort List
    Sort a linked list in O(n log n) time using constant space complexity.
    Solution
    利用归并排序的思想
    # Definition for singly-linked list.
    # class L...

    2017-01-17 itdadao 技术 15 ℃ 0
  • 【LeetCode】34. Search for a Range

    【LeetCode】34. Search for a Range

    Given an array of integers sorted in ascending order, find the starting and ending position of a given target value.
    Your algorithm's runtime complexity must be...

    2017-01-17 itdadao 技术 8 ℃ 0
  • [LeetCode] Minimum Size Subarray Sum 最短子数组之和

    [LeetCode] Minimum Size Subarray Sum 最短子数组之和

    题意
    Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn't one, return 0 i...

    2017-01-17 itdadao 技术 16 ℃ 0
  • 391. Perfect Rectangle

    391. Perfect Rectangle

    最后更新
    一刷

    16-Jan-2017
    这个题我甚至不知道该怎么总结。
    难就难在从这个题抽象出一种解法,看了别人的答案和思路= =然而没有归类总结到某种类型,这题相当于背了个题。。...

    2017-01-17 itdadao 技术 23 ℃ 0
  • 338. 1的位数 Counting Bits

    338. 1的位数 Counting Bits

    Given a non negative integer number num. For every numbers i in the range 0 ≤ i ≤ num calculate the number of 1's in their binary representation and return th...

    2017-01-16 itdadao 技术 7 ℃ 0
  • LeetCode:437. Path Sum III

    LeetCode:437. Path Sum III

    You are given a binary tree in which each node contains an integer value.
    Find the number of paths that sum to a given value.
    The path does not need to start or...

    2017-01-16 itdadao 技术 12 ℃ 0
  • leetcode-Single Number II

    leetcode-Single Number II

    Given an array of integers, every element appears three times except for one. Find that single one.
    Note:
    Your algorithm should have a linear runtime complexity...

    2017-01-16 itdadao 技术 12 ℃ 0
  • LeetCode:235. Lowest Common Ancestor of a Binary Search Tree

    LeetCode:235. Lowest Common Ancestor of a Binary Search Tree

    Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.
    According to the definition of LCA on Wikipedia: “The lo...

    2017-01-16 itdadao 技术 15 ℃ 0
  • LeetCode:20.Valid Parentheses

    LeetCode:20.Valid Parentheses

    Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
    The brackets must close in the correct or...

    2017-01-16 itdadao 技术 9 ℃ 0
  • LeetCode---Depth-first && Breadth-first

    LeetCode---Depth-first && Breadth-first

    417. Pacific Atlantic Water Flow
    思路:构造两个二维数组分别存储大西洋和太平洋的结果,先初始化边界,然后从边界出发,深度优先遍历,标记满足条件的所有节点

    static int[] dx =...

    2017-01-16 itdadao 技术 12 ℃ 0
  • leetcode-Single Number

    leetcode-Single Number

    Given an array of integers, every element appears twice except for one. Find that single one.
    Note:
    Your algorithm should have a linear runtime complexity. Coul...

    2017-01-16 itdadao 技术 14 ℃ 0
  • 【LeetCode】23. Merge k Sorted Lists

    【LeetCode】23. Merge k Sorted Lists

    合并k个已合并链表。
    思路:先把链表两两合并,直到合并至只有一个链表

    1 /**
    2 * Definition for singly-linked list.
    3 * struct ListNode {
    4 * int val;
    5 *...

    2017-01-15 itdadao 技术 13 ℃ 0
 7524    1 2 3 4 5 6 7 8 9 10 下一页 尾页
标签列表