摘要: 6. ZigZag Conversion 题面 The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this 阅读全文
posted @ 2019-05-09 22:25 yocichen 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 题面 用一个栈实现另外一个栈的顶到底降序排序 要求:不能使用额外的数据结构,但可以使用新的变量。 思路(给定栈s, 辅助栈help) 1. 遍历给定栈(出栈),栈顶出栈cur,与help栈顶比较,如果大于辅助栈顶元素值,那么辅助栈栈顶元素出栈至s栈,直到help栈顶元素值<=cur 2. help压 阅读全文
posted @ 2019-05-09 17:51 yocichen 阅读(819) 评论(0) 推荐(0) 编辑
摘要: 11. Container With Most Water 题面 Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines 阅读全文
posted @ 2019-05-09 11:14 yocichen 阅读(284) 评论(0) 推荐(0) 编辑