
LeetCode
Wayne566
这个作者很懒,什么都没留下…
展开
-
LeetCode169. Majority Element
题目Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the array is non-empty and the majority element原创 2018-01-31 12:32:52 · 122 阅读 · 0 评论 -
LeetCode400. Nth Digit
题目Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, …Note: n is positive and will fit within the range of a 32-bit signed integer.Example 1:Input:3Ou...原创 2018-03-01 20:23:25 · 158 阅读 · 0 评论 -
LeetCode383. Ransom Note
383. Ransom Note原创 2018-03-01 18:40:49 · 166 阅读 · 0 评论 -
LeetCode342. Power of Four
问题Given an integer (signed 32 bits), write a function to check whether it is a power of 4.Example: Given num = 16, return true. Given num = 5, return false.Follow up: Could you solve it without...原创 2018-02-27 21:17:51 · 205 阅读 · 0 评论 -
LeetCode290. Word Pattern
问题Given a pattern and a string str, find if str follows the same pattern.Here follow means a full match, such that there is a bijection between a letter in pattern and a non-empty word in str.Ex...原创 2018-02-27 15:48:16 · 136 阅读 · 0 评论 -
LeetCode278. First Bad Version
问题You are a product manager and currently leading a team to develop a new product. Unfortunately, the latest version of your product fails the quality check. Since each version is developed based on...原创 2018-02-27 10:15:17 · 92 阅读 · 0 评论 -
LeetCode268. Missing Number
268. Missing Number原创 2018-02-27 09:41:25 · 147 阅读 · 0 评论 -
LeetCode190. Reverse Bits
题目Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 0011100原创 2018-02-05 22:25:48 · 160 阅读 · 0 评论 -
LeetCode_21. Merge Two Sorted Lists
题目Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.Example:Input: 1->2->4, 1->3->4 Output: 1->1->2->3原创 2018-01-12 17:35:19 · 172 阅读 · 0 评论 -
LeetCode101. Symmetric Tree
题意: Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree [1,2,2,3,4,4,3] is symmetric: 1 / \ 2 2 / \ / \3 4 4原创 2018-01-20 09:01:44 · 161 阅读 · 0 评论 -
LeetCode121. Best Time to Buy and Sell Stock
题目Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock原创 2018-01-22 19:20:58 · 221 阅读 · 0 评论 -
LeetCode108. Convert Sorted Array to Binary Search Tree
题目Given an array where elements are sorted in ascending order, convert it to a height balanced BST.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of原创 2018-01-21 21:54:23 · 136 阅读 · 0 评论 -
LeetCode110. Balanced Binary Tree
题目Given a binary tree, determine if it is height-balanced.For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never dif原创 2018-01-21 21:49:52 · 189 阅读 · 0 评论 -
LeetCode136. Single Number
题目Given an array of integers, every element appears twice except for one. Find that single one.Note: Your algorithm should have a linear runtime complexity. Could you implement it without using e原创 2018-01-23 11:23:39 · 137 阅读 · 0 评论 -
LeetCode141. Linked List Cycle
题目Given a linked list, determine if it has a cycle in it.Follow up: Can you solve it without using extra space?解答一般思路:HashSetpublic class Solution { public boolean hasCycle(ListNode hea原创 2018-01-23 11:27:20 · 122 阅读 · 0 评论 -
LeetCode160. Intersection of Two Linked Lists
题目Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:A: a1 → a2 ↘原创 2018-01-29 12:41:28 · 119 阅读 · 0 评论 -
LeetCode167. Two Sum II - Input array is sorted
题目Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the two numb原创 2018-01-29 17:19:19 · 180 阅读 · 0 评论 -
LeetCode404. Sum of Left Leaves
题目Find the sum of all left leaves in a given binary tree.Example: 3 / \ 9 20 / \ 15 7There are two left leaves in the binary tree, with values 9 and 15 respectively. Retur...原创 2018-03-06 14:08:59 · 182 阅读 · 0 评论