Redtongue

人生苦短,我用Python


  • 首页

  • 归档

  • 分类

  • 标签

  • 关于

  • 搜索

901.Online Stock Span

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

Description

Write a class StockSpanner which collects daily price quotes for some stock, and returns the span of that stock’s price for the current day.

The span of the stock’s price today is defined as the maximum number of consecutive days (starting from today and going backwards) for which the price of the stock was less than or equal to today’s price.

For example, if the price of a stock over the next 7 days were [100, 80, 60, 70, 60, 75, 85], then the stock spans would be [1, 1, 1, 2, 1, 4, 6].

题目链接:https://leetcode.com/problems/online-stock-span/description/

Difficulty: medium

阅读全文 »

900.RLE Iterator

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

Description

Write an iterator that iterates through a run-length encoded sequence.

The iterator is initialized by RLEIterator(int[] A), where A is a run-length encoding of some sequence. More specifically, for all even i, A[i] tells us the number of times that the non-negative integer value A[i+1] is repeated in the sequence.

The iterator supports one function: next(int n), which exhausts the next n elements (n >= 1) and returns the last element exhausted in this way. If there is no element left to exhaust, next returns -1 instead.

For example, we start with A = [3,8,0,9,2,5], which is a run-length encoding of the sequence [8,8,8,5,5]. This is because the sequence can be read as “three eights, zero nines, two fives”.

题目链接:https://leetcode.com/problems/rle-iterator/description/

Difficulty: medium

阅读全文 »

[nowcoder56]删除链表中重复的结点

发表于 2018-09-08 | 更新于: 2018-11-13 | 分类于 nowcoder

题目描述

在一个排序的链表中,存在重复的结点,请删除该链表中重复的结点,重复的结点不保留,返回链表头指针。 例如,链表1->2->3->3->4->4->5 处理后为 1->2->5

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

阅读全文 »

[nowcoder55]链表中环的入口结点

发表于 2018-09-08 | 更新于: 2018-11-13 | 分类于 nowcoder

题目描述

给一个链表,若其中包含环,请找出该链表的环的入口结点,否则,输出null。

题目链接: https://www.nowcoder.com/practice/253d2c59ec3e4bc68da16833f79a38e4

阅读全文 »

[nowcoder54]字符流中第一个不重复的字符

发表于 2018-09-08 | 更新于: 2018-11-13 | 分类于 nowcoder

题目描述

请实现一个函数用来找出字符流中第一个只出现一次的字符。例如,当从字符流中只读出前两个字符”go”时,第一个只出现一次的字符是”g”。当从该字符流中读出前六个字符“google”时,第一个只出现一次的字符是”l”。

题目链接: https://www.nowcoder.com/practice/00de97733b8e4f97a3fb5c680ee10720

阅读全文 »

[nowcoder53]表示数值的字符串

发表于 2018-09-08 | 更新于: 2018-11-13 | 分类于 nowcoder

题目描述

请实现一个函数用来判断字符串是否表示数值(包括整数和小数)。例如,字符串”+100”,”5e2”,”-123”,”3.1416”和”-1E-16”都表示数值。 但是”12e”,”1a3.14”,”1.2.3”,”+-5”和”12e+4.3”都不是。

题目链接: https://www.nowcoder.com/practice/6f8c901d091949a5837e24bb82a731f2

阅读全文 »

[nowcoder52]正则表达式匹配

发表于 2018-09-08 | 更新于: 2018-11-13 | 分类于 nowcoder

题目描述

请实现一个函数用来匹配包括’.’和’‘的正则表达式。模式中的字符’.’表示任意一个字符,而’‘表示它前面的字符可以出现任意次(包含0次)。 在本题中,匹配是指字符串的所有字符匹配整个模式。例如,字符串”aaa”与模式”a.a”和”abaca”匹配,但是与”aa.a”和”ab*a”均不匹配

题目链接: https://www.nowcoder.com/practice/45327ae22b7b413ea21df13ee7d6429c

阅读全文 »

899.Orderly Queue

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

Description

A string S of lowercase letters is given. Then, we may make any number of moves.

In each move, we choose one of the first K letters (starting from the left), remove it, and place it at the end of the string.

Return the lexicographically smallest string we could have after any number of moves.

题目链接:https://leetcode.com/problems/orderly-queue/description/

Difficulty: hard

阅读全文 »

898.Bitwise ORs of Subarrays

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

Description

We have an array A of non-negative integers.

For every (contiguous) subarray B = [A[i], A[i+1], …, A[j]] (with i <= j), we take the bitwise OR of all the elements in B, obtaining a result A[i] | A[i+1] | … | A[j].

Return the number of possible results. (Results that occur more than once are only counted once in the final answer.)

题目链接:https://leetcode.com/problems/bitwise-ors-of-subarrays/description/

Difficulty: medium

阅读全文 »

897.Increasing Order Search Tree

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

Description

Given a tree, rearrange the tree in in-order so that the leftmost node in the tree is now the root of the tree, and every node has no left child and only 1 right child.

题目链接:https://leetcode.com/problems/increasing-order-search-tree/description/

Difficulty: easy

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

yunxiang wang

记录点点

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