04 2019 档案
摘要:题目: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can yo
阅读全文
摘要:题目: Given a linked list, determine if it has a cycle in it. To represent a cycle in the given linked list, we use an integer pos which represents the
阅读全文
摘要:题目: You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way. The null node needs to be
阅读全文
摘要:题目: Given a non-negative integer c, your task is to decide whether there're two integers a and b such that a2 + b2 = c. Example 1: Example 2: 分析: 给定一个
阅读全文
摘要:题目: Given two binary trees and imagine that when you put one of them to cover the other, some nodes of the two trees are overlapped while the others a
阅读全文
摘要:题目: Given an integer array, find three numbers whose product is maximum and output the maximum product. Example 1: Example 2: 分析: 给定一个数组,返回其中三个元素乘积的最大
阅读全文
摘要:题目: Given a non-empty binary tree, return the average value of the nodes on each level in the form of an array. Example 1: Note: 分析: 题目很好理解,就是求二叉树每一层的
阅读全文
摘要:题目: You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontall
阅读全文
摘要:题目: Given an integer, return its base 7 string representation. Example 1: Example 2: Note: The input will be in range of [-1e7, 1e7]. 分析: 给定一个7进制数,求十进
阅读全文
摘要:题目: You are given a string representing an attendance record for a student. The record only contains the following three characters: A student could b
阅读全文
摘要:题目: Given an integer array nums, find the sum of the elements between indices iand j (i ≤ j), inclusive. Example: Note: 分析: 题目的意思很简单,给定一个数组,使用sumRange
阅读全文
摘要:题目: Print a binary tree in an m*n 2D string array following these rules: Example 1: Example 2: Example 3: Note: The height of binary tree is in the ra
阅读全文
摘要:题目: Given an array of 2n integers, your task is to group these integers into npairs of integer, say (a1, b1), (a2, b2), ..., (an, bn) which makes sum
阅读全文
摘要:题目: In MATLAB, there is a very useful function called 'reshape', which can reshape a matrix into a new one with different size but keep its original d
阅读全文
摘要:题目: The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out
阅读全文
摘要:题目: Find the sum of all left leaves in a given binary tree. Example: 分析: 给定一颗二叉树,求左叶子节点的和。 重点在于如何判断左叶子节点,如果一个节点的left存在,且left的left和right都为空,那么我们就可以将这个节
阅读全文
摘要:题目: 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
阅读全文
摘要:题目: The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, ca
阅读全文
摘要:题目: There is a robot starting at position (0, 0), the origin, on a 2D plane. Given a sequence of its moves, judge if this robot ends up at (0, 0) afte
阅读全文
摘要:题目: 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 hav
阅读全文

浙公网安备 33010602011771号