- 博客(16)
- 资源 (2)
- 收藏
- 关注
原创 Palindrome Linked List
1 题目描述Given a singly linked list, determine if it is a palindrome.题目出处:https://leetcode.com/problems/palindrome-linked-list/2 解题思路题目类型为:单链表和双指针题目,这类题目主要是使用两个指针来确定一些关系。题目中还使用了栈进行辅助,用来进行下一
2015-07-12 14:38:37 285
原创 Excel Sheet Column Title
1 题目描述Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB
2015-07-09 21:41:57 345
原创 Rotate Array
1 题目描述Rotate an array of n elements to the right by k steps.For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4].Note:Try to come up as many sol
2015-07-09 20:51:02 284
原创 House Robber
1 题目描述You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that ad
2015-07-09 16:07:34 265
原创 Happy Number
1 题目描述Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of
2015-07-09 09:29:31 267
原创 Invert Binary Tree
1 题目描述Invert a binary tree. 4 / \ 2 7 / \ / \1 3 6 9to 4 / \ 7 2 / \ / \9 6 3 1题目出处:https://leetcode.com/problems/invert-binary-tree/2 解题思
2015-07-08 22:34:36 267
原创 Contains Duplicate II
1 题目描述Given an array of integers and an integer k, find out whether there there are two distinct indices i and j in the array such that nums[i] = nums[j] and the difference between iand j is
2015-07-08 10:49:13 256
原创 Implement Queue using Stacks
1 题目描述Implement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front of queue.peek() -- Get the front el
2015-07-07 21:36:37 390
原创 Rectangle Area
1 题目描述Find the total area covered by two rectilinear rectangles in a 2D plane.Each rectangle is defined by its bottom left corner and top right corner as shown in the figure.Assume t
2015-07-07 21:01:01 290
原创 Isomorphic Strings
1 题目描述Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to get t.All occurrences of a character must be replac
2015-07-07 16:55:15 381
原创 Implement Stack using Queues
1 题目描述Implement the following operations of a stack using queues.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get the top element.empty() --
2015-07-07 15:45:11 262
原创 Min Stack
1 题目描述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 the element on top of the stack.t
2015-07-07 10:57:53 296
原创 Summary Ranges
1 题目描述Given a sorted integer array without duplicates, return the summary of its ranges.For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"].题目出处:https://leetcode.com/problems/summ
2015-07-06 20:54:55 273
原创 Compare Version Numbers
1 题目描述Compare two version numbers version1 and version2.If version1 > version2 return 1, if version1 version2 return -1, otherwise return 0.You may assume that the version strings are non-
2015-07-06 19:48:18 254
原创 Power of Two
1 题目描述Given an integer, write a function to determine if it is a power of two.题目出处:https://leetcode.com/problems/power-of-two/2 解题思路采用打表的方式,因为个数不是很多。采用hashset方式,提高查找效率。3 源代码pac
2015-07-06 17:01:13 373
原创 Contains Duplicate
1 题目描述Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the array, and it should return false if every
2015-07-02 21:57:58 290
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人