随笔分类 -  Leetcode

摘要:169. 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. Y 阅读全文
posted @ 2017-11-07 20:48 绿宝宝怪 阅读(94) 评论(0) 推荐(0)
摘要:717. 1-bit and 2-bit Characters We have two special characters. The first character can be represented by one bit 0. The second character can be repre 阅读全文
posted @ 2017-11-07 20:42 绿宝宝怪 阅读(167) 评论(0) 推荐(0)
摘要:697. Degree of an Array Given a non-empty array of non-negative integers nums, the degree of this array is defined as the maximum frequency of any one 阅读全文
posted @ 2017-11-07 20:25 绿宝宝怪 阅读(158) 评论(0) 推荐(0)
摘要:606. Construct String from Binary Tree You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traver 阅读全文
posted @ 2017-10-29 20:15 绿宝宝怪 阅读(140) 评论(0) 推荐(0)
摘要:104. Maximum Depth of Binary Tree Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from th 阅读全文
posted @ 2017-10-29 20:00 绿宝宝怪 阅读(130) 评论(0) 推荐(0)
摘要:669. Trim a Binary Search Tree Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that all its elements lie 阅读全文
posted @ 2017-10-29 19:51 绿宝宝怪 阅读(149) 评论(0) 推荐(0)
摘要:122. Best Time to Buy and Sell Stock II Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to 阅读全文
posted @ 2017-10-29 19:43 绿宝宝怪 阅读(255) 评论(0) 推荐(0)
摘要:617. Merge Two Binary Trees 递归!递归! 阅读全文
posted @ 2017-10-29 19:12 绿宝宝怪 阅读(188) 评论(0) 推荐(0)
摘要:283. Move Zeroes Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. 阅读全文
posted @ 2017-10-29 18:59 绿宝宝怪 阅读(104) 评论(0) 推荐(0)
摘要:448. Find All Numbers Disappeared in an Array Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others 阅读全文
posted @ 2017-10-29 18:26 绿宝宝怪 阅读(141) 评论(0) 推荐(0)
摘要:234. Palindrome Linked List Given a singly linked list, determine if it is a palindrome. 阅读全文
posted @ 2017-10-29 18:05 绿宝宝怪 阅读(137) 评论(0) 推荐(0)
摘要:160. 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 f 阅读全文
posted @ 2017-10-29 17:00 绿宝宝怪 阅读(143) 评论(0) 推荐(0)
摘要:单链表的操作 阅读全文
posted @ 2017-10-24 22:00 绿宝宝怪 阅读(169) 评论(0) 推荐(0)
摘要:203. Remove Linked List Elements Remove all elements from a linked list of integers that have value val. ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 阅读全文
posted @ 2017-10-24 19:41 绿宝宝怪 阅读(147) 评论(0) 推荐(0)
摘要:141. Linked List Cycle 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 @ 2017-10-24 18:58 绿宝宝怪 阅读(175) 评论(0) 推荐(0)
摘要: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 th 阅读全文
posted @ 2017-10-24 18:43 绿宝宝怪 阅读(185) 评论(0) 推荐(0)
摘要:83. Remove Duplicates from Sorted List Given a sorted linked list, delete all duplicates such that each element appear only once. For example,Given 1- 阅读全文
posted @ 2017-10-24 18:29 绿宝宝怪 阅读(132) 评论(0) 推荐(0)
摘要:206. Reverse Linked List Reverse a singly linked list. Hint: A linked list can be reversed either iteratively or recursively. Could you implement both 阅读全文
posted @ 2017-10-24 17:00 绿宝宝怪 阅读(120) 评论(0) 推荐(0)
摘要:237. Delete Node in a Linked List 思路:用node节点的下一个节点来覆盖node节点,然后删除node的下一个节点 阅读全文
posted @ 2017-10-24 16:06 绿宝宝怪 阅读(126) 评论(0) 推荐(0)
摘要:Given a linked list, remove the nth node from the end of list and return its head. For example, Note:Given n will always be valid.Try to do this in on 阅读全文
posted @ 2017-10-23 14:02 绿宝宝怪 阅读(146) 评论(0) 推荐(0)

#site_nav_under,#ad_under_post_holder,#under_post_news,#google_ad_c2,#under_post_kb{ width:0; height:0; display:none; overflow:hidden; }