摘要: Design a stack that supports push, pop, top, and retrieving the minimum element in constant time.push(x) -- Push element x onto stack.pop() -- Removes... 阅读全文
posted @ 2015-08-04 15:28 尾巴草 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the c... 阅读全文
posted @ 2015-08-04 11:25 尾巴草 阅读(109) 评论(0) 推荐(0) 编辑
摘要: Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?回文链表即原链表与逆置链表相同,采用辅助栈的特点将链表逆置。(知道链表长... 阅读全文
posted @ 2015-08-04 10:59 尾巴草 阅读(132) 评论(0) 推荐(0) 编辑
摘要: Given two strings s and t, write a function to determine if t is an anagram of s.For example,s = "anagram", t = "nagaram", return true.s = "rat", t = ... 阅读全文
posted @ 2015-08-04 10:38 尾巴草 阅读(94) 评论(0) 推荐(0) 编辑
摘要: Given a list, rotate the list to the right by k places, where k is non-negative.For example:Given 1->2->3->4->5->NULL and k = 2,return 4->5->1->2->3->... 阅读全文
posted @ 2015-08-04 10:27 尾巴草 阅读(119) 评论(0) 推荐(0) 编辑