地址:https://leetcode-cn.com/problems/implement-queue-using-stacks/ <?php /** 232. 用栈实现队列 使用栈实现队列的下列操作: push(x) -- 将一个元素放入队列的尾部。 pop() -- 从队列首部移除元素。 pee ...
分类:
其他好文 时间:
2020-04-11 16:56:35
阅读次数:
74
d地址:https://leetcode-cn.com/problems/implement-strstr/ <?php /** 实现 strStr() 函数。 给定一个 haystack 字符串和一个 needle 字符串,在 haystack 字符串中找出 needle 字符串出现的第一个位置 ...
分类:
其他好文 时间:
2020-04-09 17:55:58
阅读次数:
97
一、题目说明 题目208. Implement Trie (Prefix Tree),实现trie,包括insert、search、startsWith。 二、我的解答 Trie树,又叫“字典树”,“前缀树”。实现代码如下: 性能如下: 三、优化措施 ...
分类:
其他好文 时间:
2020-04-04 18:36:12
阅读次数:
65
题目如下: Implement the class UndergroundSystem that supports three methods: 1. checkIn(int id, string stationName, int t) A customer with id card equal t ...
分类:
其他好文 时间:
2020-04-04 14:27:25
阅读次数:
69
1 /** 2 * // This is the interface that allows for creating nested lists. 3 * // You should not implement it, or speculate about its implementation 4 ...
分类:
其他好文 时间:
2020-04-02 15:56:20
阅读次数:
67
题目描述 Given an input string (s) and a pattern (p), implement regular expression matching with support for '.' and '*'. '.' Matches any single character ...
分类:
其他好文 时间:
2020-03-30 12:48:40
阅读次数:
69
Q:Implement strStr(). Returns the index of the first occurrence of needle in haystack, or 1 if needle is not part of haystack. A:KMP算法 kmp算法的思想就是:在匹配过 ...
分类:
其他好文 时间:
2020-03-23 17:15:17
阅读次数:
59
LeetCode#225-Implement Stack using Queues-用队列实现栈 ...
分类:
其他好文 时间:
2020-03-22 19:32:09
阅读次数:
58
原题链接在这里:https://leetcode.com/problems/implement-rand10-using-rand7/ 题目: Given a function rand7 which generates a uniform random integer in the range 1 ...
分类:
其他好文 时间:
2020-03-21 09:59:59
阅读次数:
57
Design a stack which supports the following operations. Implement the CustomStack class: CustomStack(int maxSize) Initializes the object with maxSize ...
分类:
其他好文 时间:
2020-03-16 09:53:58
阅读次数:
54