摘要: 题目描述 使用队列实现栈的下列操作: push(x) -- 元素 x 入栈pop() -- 移除栈顶元素top() -- 获取栈顶元素empty() -- 返回栈是否为空注意: 你只能使用队列的基本操作-- 也就是 push to back, peek/pop from front, size, 和 阅读全文
posted @ 2020-03-01 22:31 Transkai 阅读(203) 评论(0) 推荐(0) 编辑
摘要: 题目描述 实现 strStr() 函数。 给定一个 haystack 字符串和一个 needle 字符串,在 haystack 字符串中找出 needle 字符串出现的第一个位置 (从0开始)。如果不存在,则返回 -1。 示例 1: 输入: haystack = "hello", needle = 阅读全文
posted @ 2020-03-01 21:41 Transkai 阅读(922) 评论(0) 推荐(0) 编辑