杨帆博客

你想开发游戏还是改变世界?


  • 首页

  • 标签

  • 归档

  • 搜索

Binary-Tree-Pruning

发表于 2018-06-27 | 更新于: 2018-08-22

题目地址

LeetCode#814 Binary Tree Pruning

题目描述

  We are given the head node root of a binary tree, where additionally every node’s value is either a 0 or a 1.

  Return the same tree where every subtree (of the given tree) not containing a 1 has been removed.

  (Recall that the subtree of a node X is X, plus every node that is a descendant of X.)

阅读全文 »

Flipping-an-Image

发表于 2018-06-26 | 更新于: 2018-08-22

题目地址

LeetCode#832 Flipping an Image

题目描述

  Given a binary matrix A, we want to flip the image horizontally, then invert it, and return the resulting image.

  To flip an image horizontally means that each row of the image is reversed. For example, flipping [1, 1, 0] horizontally results in [0, 1, 1].

  To invert an image means that each 0 is replaced by 1, and each 1 is replaced by 0. For example, inverting [0, 1, 1] results in [1, 0, 0].

阅读全文 »

Peak-Index-in-a-Mountain-Array

发表于 2018-06-25 | 更新于: 2018-08-22

题目地址

LeetCode#852 Peak Index in a Mountain Array

题目描述

  Let’s call an array A a mountain if the following properties hold:

  • A.length >= 3
  • There exists some 0 < i < A.length - 1 such that A[0] < A[1] < ... A[i-1] < A[i] > A[i+1] > ... > A[A.length - 1]

  Given an array that is definitely a mountain, return any i such that A[0] < A[1] < ... A[i-1] < A[i] > A[i+1] > ... > A[A.length - 1].

阅读全文 »

Max-Increase-to-Keep-City-Skyline

发表于 2018-06-24 | 更新于: 2018-08-22

题目地址

LeetCode#807 Max Increase to Keep City Skyline

题目描述

  In a 2 dimensional array grid, each value grid[i][j] represents the height of a building located there. We are allowed to increase the height of any number of buildings, by any amount (the amounts can be different for different buildings). Height 0 is considered to be a building as well.

阅读全文 »

Unique-Binary-Search-Trees

发表于 2018-05-26 | 更新于: 2018-08-22

题目地址

LeetCode#96 Unique Binary Search Trees

题目描述

  Given n, how many structurally unique BST’s (binary search trees) that store values 1 … n?

阅读全文 »
1234…46
KsGin

KsGin

游戏程序员/计算机图形学/Unity/西山居搬砖

226 日志
16 标签
GitHub E-Mail Google Twitter
© 2018 KsGin @ 2018
0%