随笔分类 -  LeetCode

摘要:Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: Example 1: Example 2: Example 3: A 1 AA 26+ 阅读全文
posted @ 2019-06-11 15:52 GoodRnne 阅读(180) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2019-06-09 15:18 GoodRnne 阅读(137) 评论(0) 推荐(0)
摘要:A peak element is an element that is greater than its neighbors.Given an input array nums, where nums[i] ≠ nums[i+1], find a peak element and return i 阅读全文
posted @ 2019-06-08 16:03 GoodRnne 阅读(238) 评论(0) 推荐(0)
摘要:Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: begin to in 阅读全文
posted @ 2019-06-07 20:19 GoodRnne 阅读(174) 评论(0) 推荐(0)
摘要:Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand. (i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]). F 阅读全文
posted @ 2019-06-06 10:06 GoodRnne 阅读(155) 评论(0) 推荐(0)
摘要:Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product. Example 1: E 阅读全文
posted @ 2019-06-05 15:59 GoodRnne 阅读(157) 评论(0) 推荐(0)
摘要:Sort a linked list using insertion sort. Example 1: Example 2: 阅读全文
posted @ 2019-06-04 11:48 GoodRnne 阅读(495) 评论(0) 推荐(0)
摘要:Given a binary tree, return the preorder traversal of its nodes' values. Example: Follow up: Recursive solution is trivial, could you do it iterativel 阅读全文
posted @ 2019-06-02 17:17 GoodRnne 阅读(445) 评论(0) 推荐(0)
摘要:Given a linked list, return the node where the cycle begins. If there is no cycle, return null. To represent a cycle in the given linked list, we use 阅读全文
posted @ 2019-05-31 19:16 GoodRnne 阅读(503) 评论(0) 推荐(0)
摘要:Given a non-empty string s and a dictionary wordDict containing a list of non-empty words, determine if s can be segmented into a space-separated sequ 阅读全文
posted @ 2019-05-30 17:15 GoodRnne 阅读(927) 评论(0) 推荐(0)
摘要:There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the following re 阅读全文
posted @ 2019-05-29 19:59 GoodRnne 阅读(774) 评论(0) 推荐(0)
摘要:Given a non-empty array of integers, every element appears three times except for one, which appears exactly once. Find that single one. Note: Your al 阅读全文
posted @ 2019-05-27 16:58 GoodRnne 阅读(221) 评论(0) 推荐(0)
摘要:There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs 阅读全文
posted @ 2019-05-26 11:43 GoodRnne 阅读(369) 评论(0) 推荐(0)
摘要:Given a non-empty array of integers, every element appears twice except for one. Find that single one. Note: Your algorithm should have a linear runti 阅读全文
posted @ 2019-05-26 11:18 GoodRnne 阅读(193) 评论(0) 推荐(0)
摘要:Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number. An example is the root-to-leaf path1->2->3 which 阅读全文
posted @ 2019-05-24 19:17 GoodRnne 阅读(172) 评论(0) 推荐(0)
摘要:Given an unsorted array of integers, find the length of the longest consecutive elements sequence. Your algorithm should run in O(n) complexity. Examp 阅读全文
posted @ 2019-05-24 19:01 GoodRnne 阅读(328) 评论(0) 推荐(0)
摘要:Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, 阅读全文
posted @ 2019-05-23 19:45 GoodRnne 阅读(220) 评论(0) 推荐(0)
摘要:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. Note: For the purpose of this problem, w 阅读全文
posted @ 2019-05-22 20:30 GoodRnne 阅读(164) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2019-05-21 19:42 GoodRnne 阅读(272) 评论(0) 推荐(0)
摘要:Given a binary tree, flatten it to a linked list in-place. For example, given the following tree: The flattened tree should look like: 阅读全文
posted @ 2019-05-20 11:31 GoodRnne 阅读(219) 评论(0) 推荐(0)