algorithm
文章平均质量分 65
liao_zx
这个作者很懒,什么都没留下…
展开
-
【LeetCode】53.Maximum Subarray
LeetCode 53 思路 代码 class Solution { public: int divide(vectorint>& nums, int s, int e) { if (s > e) return 0; if (s == e) return nums[s]; int mid = s + (e - s) / 2;原创 2017-09-17 16:14:52 · 199 阅读 · 0 评论 -
【LeetCode】242. Valid Anagram
问题描述 Given two strings s and t, write a function to determine if t is an anagram of s. For example, s = “anagram”, t = “nagaram”, return true. s = “rat”, t = “car”, return false. Note原创 2018-01-02 16:25:16 · 132 阅读 · 0 评论 -
【LeetCode】455. Assign Cookies
问题描述Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi, which is the minimum size of a原创 2018-01-02 15:36:51 · 153 阅读 · 0 评论 -
【LeetCode】637 Average of Levels in Binary Tree
问题描述Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array. Input: 3 / \ 9 20 / \ 15 7 Output: [3, 14.5, 11]原创 2018-01-02 15:10:21 · 157 阅读 · 0 评论 -
《算法概论》8.19
问题描述 A kite is a graph on an even number of vertices, say 2n, in which n of the vertices form a clique and the remaining n vertices are connected in a “tail” that consists of a path joined to one of原创 2018-01-01 15:19:09 · 256 阅读 · 0 评论 -
【LeetCode】330. Patching Array
问题描述 Given a sorted positive integer array nums and an integer n, add/patch elements to the array such that any number in range [1, n] inclusive can be formed by the sum of some elements in the array原创 2017-12-06 11:02:56 · 168 阅读 · 0 评论 -
【LeetCode】540. Single Element in a Sorted Array
题目描述Given a sorted array consisting of only integers where every element appears twice except for one element which appears once. Find this single element that appears only once.Note: Your solution sho原创 2017-10-15 13:13:20 · 207 阅读 · 0 评论 -
【LeetCode】112,113,437. Path Sum I, II, III
LeetCode 112 113 437原创 2017-10-25 14:15:34 · 231 阅读 · 0 评论 -
【LeetCode】1. Two Sum
Given an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one soluti原创 2017-10-18 22:16:14 · 139 阅读 · 0 评论 -
【LeetCode】4.Median of Two Sorted Arrays
Divide and Conquer 问题描述: There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should beO(log (m+原创 2017-09-10 16:21:06 · 253 阅读 · 0 评论 -
【LeetCode】684. Redundant Connection
问题描述 In this problem, a tree is an undirected graph that is connected and has no cycles. The given input is a graph that started as a tree with N nodes (with distinct values 1, 2, ..., N), wit原创 2017-10-29 15:33:58 · 738 阅读 · 0 评论