伪程序员的世界

Debug myself and debug the world!


  • 首页

  • 归档

  • 分类

  • 标签

  • 搜索

LeetCode 215. Kth Largest Element in an Array

发表于 2017-12-24 | 分类于 算法 , LeetCode
字数统计: 435 | 阅读时长≈ 0:01

LeetCode 215. Kth Largest Element in an Array

Description:

Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.
For example,
Given [3,2,1,5,6,4] and k = 2, return 5.

阅读全文 »

LeetCode 733. Flood Fill

发表于 2017-12-24 | 分类于 算法 , LeetCode
字数统计: 1.8k | 阅读时长≈ 0:02

LeetCode 733. Flood Fill

Description:

An image is represented by a 2-D array of integers, each integer representing the pixel value of the image (from 0 to 65535).

Given a coordinate (sr, sc) representing the starting pixel (row and column) of the flood fill, and a pixel value newColor, “flood fill” the image.

To perform a “flood fill”, consider the starting pixel, plus any pixels connected 4-directionally to the starting pixel of the same color as the starting pixel, plus any pixels connected 4-directionally to those pixels (also with the same color as the starting pixel), and so on. Replace the color of all of the aforementioned pixels with the newColor.

At the end, return the modified image.

阅读全文 »

LeetCode 690.Employee Importance

发表于 2017-12-22 | 分类于 算法 , LeetCode
字数统计: 3.3k | 阅读时长≈ 0:03

LeetCode 690.Employee Importance

Description:

You are given a data structure of employee information, which includes the employee’s unique id, his importance value and his direct subordinates’ id.

For example, employee 1 is the leader of employee 2, and employee 2 is the leader of employee 3. They have importance value 15, 10 and 5, respectively. Then employee 1 has a data structure like [1, 15, [2]], and employee 2 has [2, 10, [3]], and employee 3 has [3, 5, []]. Note that although employee 3 is also a subordinate of employee 1, the relationship is not direct.

Now given the employee information of a company, and an employee id, you need to return the total importance value of this employee and all his subordinates.

阅读全文 »

LeetCode 257. Binary Tree Paths

发表于 2017-12-22 | 分类于 算法 , LeetCode
字数统计: 2k | 阅读时长≈ 0:02

LeetCode 257. Binary Tree Paths

Description:

Given a binary tree, return all root-to-leaf paths.

阅读全文 »

LeetCode 113. Path Sum II

发表于 2017-12-19 | 分类于 算法 , LeetCode
字数统计: 2.4k | 阅读时长≈ 0:02

LeetCode 113. Path Sum II

Description:

Given a binary tree and a sum, find all root-to-leaf paths where each path’s sum equals the given sum.

阅读全文 »

LeetCode 112. Path Sum

发表于 2017-12-19 | 分类于 算法 , LeetCode
字数统计: 1.7k | 阅读时长≈ 0:02

LeetCode 112. Path Sum

Description:

Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.

阅读全文 »

LeetCode 109. Convert Sorted List to Binary Search Tree

发表于 2017-12-18 | 分类于 算法 , LeetCode
字数统计: 3.3k | 阅读时长≈ 0:03

LeetCode 109. Convert Sorted List to Binary Search Tree

Description:

Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.

For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by more than 1.

阅读全文 »

LeetCode 108. Convert Sorted Array to Binary Search Tree

发表于 2017-12-18 | 分类于 算法 , LeetCode
字数统计: 2k | 阅读时长≈ 0:02

LeetCode 108. Convert Sorted Array to Binary Search Tree

Description:

Given an array where elements are sorted in ascending order, convert it to a height balanced BST.

For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by more than 1.

阅读全文 »

LeetCode 111. Minimum Depth of Binary Tree

发表于 2017-12-18 | 分类于 算法 , LeetCode
字数统计: 1.7k | 阅读时长≈ 0:02

LeetCode Minimum Depth of Binary Tree

Description:

Given a binary tree, find its minimum depth.

The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.

阅读全文 »

LeetCode 110. Balanced Binary Tree

发表于 2017-12-18 | 分类于 算法 , LeetCode
字数统计: 1.8k | 阅读时长≈ 0:02

LeetCode 110. Balanced Binary Tree

Description:

Given a binary tree, determine if it is height-balanced.

For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by more than 1.

阅读全文 »
1…678…11
linjiafengyang

linjiafengyang

Debug myself and debug the world!

106 日志
7 分类
3 标签
GitHub CSDN
© 2019 linjiafengyang | 394k | 6:34