Redtongue

人生苦短,我用Python


  • 首页

  • 归档

  • 分类

  • 标签

  • 关于

  • 搜索

896.Monotonic Array

发表于 2018-09-02 | 更新于: 2018-09-02 | 分类于 leetcode

Description

An array is monotonic if it is either monotone increasing or monotone decreasing.

An array A is monotone increasing if for all i <= j, A[i] <= A[j]. An array A is monotone decreasing if for all i <= j, A[i] >= A[j].

Return true if and only if the given array A is monotonic.

题目链接:https://leetcode.com/problems/monotonic-array/description/

Difficulty: easy

阅读全文 »

[nowcoder51]构建乘积数组

发表于 2018-09-01 | 更新于: 2018-10-15 | 分类于 nowcoder

题目描述

给定一个数组A[0,1,…,n-1],请构建一个数组B[0,1,…,n-1],其中B中的元素B[i]=A[0]A[1]…A[i-1]A[i+1]…A[n-1]。不能使用除法。

题目链接: https://www.nowcoder.com/practice/94a4d381a68b47b7a8bed86f2975db46

阅读全文 »

[nowcoder50]数组中重复的数字

发表于 2018-09-01 | 更新于: 2018-10-15 | 分类于 nowcoder

题目描述

在一个长度为n的数组里的所有数字都在0到n-1的范围内。 数组中某些数字是重复的,但不知道有几个数字是重复的。也不知道每个数字重复几次。请找出数组中任意一个重复的数字。 例如,如果输入长度为7的数组{2,3,1,0,2,5,3},那么对应的输出是第一个重复的数字2。

题目链接: https://www.nowcoder.com/practice/623a5ac0ea5b4e5f95552655361ae0a8

阅读全文 »

[nowcoder49]把字符串转换成整数

发表于 2018-09-01 | 更新于: 2018-10-15 | 分类于 nowcoder

题目描述

将一个字符串转换成一个整数(实现Integer.valueOf(string)的功能,但是string不符合数字要求时返回0),要求不能使用字符串转换整数的库函数。 数值为0或者字符串不是一个合法的数值则返回0。

题目链接: https://www.nowcoder.com/practice/1277c681251b4372bdef344468e4f26e

阅读全文 »

[nowcoder48]不用加减乘除做加法

发表于 2018-09-01 | 更新于: 2018-10-15 | 分类于 nowcoder

题目描述

写一个函数,求两个整数之和,要求在函数体内不得使用+、-、*、/四则运算符号。

题目链接: https://www.nowcoder.com/practice/59ac416b4b944300b617d4f7f111b215

阅读全文 »

[nowcoder47]求1+2+3+...+n

发表于 2018-09-01 | 更新于: 2018-10-15 | 分类于 nowcoder

题目描述

求1+2+3+…+n,要求不能使用乘除法、for、while、if、else、switch、case等关键字及条件判断语句(A?B:C)。

题目链接: https://www.nowcoder.com/practice/7a0da8fc483247ff8800059e12d7caf1

阅读全文 »

895.Maximum Frequency Stack

发表于 2018-08-27 | 更新于: 2018-09-02 | 分类于 leetcode

Description

Implement FreqStack, a class which simulates the operation of a stack-like data structure.

FreqStack has two functions:

  • push(int x), which pushes an integer x onto the stack.

  • pop(), which removes and returns the most frequent element in the stack.
    If there is a tie for most frequent element, the element closest to the top of the stack is removed and returned.

题目链接:https://leetcode.com/problems/maximum-frequency-stack/description/

Difficulty: hard

阅读全文 »

894.All Possible Full Binary Trees

发表于 2018-08-27 | 更新于: 2018-09-02 | 分类于 leetcode

Description

A full binary tree is a binary tree where each node has exactly 0 or 2 children.

Return a list of all possible full binary trees with N nodes. Each element of the answer is the root node of one possible tree.

Each node of each tree in the answer must have node.val = 0.

You may return the final list of trees in any order.

题目链接:https://leetcode.com/problems/all-possible-full-binary-trees/description/

Difficulty: medium

阅读全文 »

893.Groups of Special-Equivalent Strings

发表于 2018-08-27 | 更新于: 2018-09-02 | 分类于 leetcode

Description

You are given an array A of strings.

Two strings S and T are special-equivalent if after any number of moves, S == T.

A move consists of choosing two indices i and j with i % 2 == j % 2, and swapping S[i] with S[j].

Now, a group of special-equivalent strings from A is a non-empty subset S of A such that any string not in S is not special-equivalent with any string in S.

Return the number of groups of special-equivalent strings from A.

题目链接:https://leetcode.com/problems/groups-of-special-equivalent-strings/description/

Difficulty: easy

阅读全文 »

892.Surface Area of 3D Shapes

发表于 2018-08-27 | 更新于: 2018-09-02 | 分类于 leetcode

Description

On a N N grid, we place some 1 1 * 1 cubes.

Each value v = grid[i][j] represents a tower of v cubes placed on top of grid cell (i, j).

Return the total surface area of the resulting shapes.

题目链接:https://leetcode.com/problems/surface-area-of-3d-shapes/description/

Difficulty: easy

阅读全文 »
1…121314…21
yunxiang wang

yunxiang wang

记录点点

202 日志
4 分类
41 标签
GitHub E-Mail
© 2016 — 2020 yunxiang wang