![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
Sirius_Chen
这个作者很懒,什么都没留下…
展开
-
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./** * Definition for singly-linked list. * struct Lis原创 2017-03-20 16:28:57 · 178 阅读 · 0 评论 -
540. Single Element in a Sorted Array
540. Single Element in a Sorted ArrayGiven a sortedarray consisting of only integers where every element appears twice except forone element which appears once. Find this single element that appears原创 2017-04-05 21:45:19 · 452 阅读 · 0 评论 -
232. Implement Queue using Stacks
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 element.empty(原创 2017-03-21 12:45:15 · 242 阅读 · 0 评论 -
141. 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?设两个指向输入链表的指针,walker和runner,制造一个while函数,一次循环walker指向下一个链表,runner指向下下个链表,如果输入链表是一个环,原创 2017-03-30 21:36:42 · 242 阅读 · 0 评论 -
86. Partition List
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order of the nodes in each of原创 2017-03-30 21:11:24 · 208 阅读 · 0 评论 -
94. Binary Tree Inorder Traversal
Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree [1,null,2,3], 1 \ 2 / 3return [1,3,2]./** * Definit原创 2017-03-23 13:08:35 · 174 阅读 · 0 评论 -
152. Maximum Product Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4],the contiguous subarray [2,3] has the largest原创 2017-03-27 23:17:49 · 213 阅读 · 0 评论 -
225. Implement Stack using Queues
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() -- Return whet原创 2017-03-21 12:43:30 · 219 阅读 · 0 评论 -
100. Same Tree
Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical and the nodes have the same value.Subscr原创 2017-03-26 20:55:31 · 249 阅读 · 1 评论 -
53. Maximum Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,1,-5,4],the contiguous subarray [4,-1,2,1] ha原创 2017-03-27 21:57:46 · 163 阅读 · 0 评论 -
19. Remove Nth Node From End of List
Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the原创 2017-03-20 16:32:09 · 161 阅读 · 0 评论 -
458. Poor Pigs
458. Poor PigsThere are 1000 buckets, one and only one of them containspoison, the rest are filled with water. They all look the same. If a pig drinksthat poison it will die within 15 minutes. What原创 2017-04-06 22:27:13 · 322 阅读 · 0 评论