![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
algorithm
CuteRainbow
我是一个热爱生活的人
展开
-
【LeetCode】之Remove Nth Node From End of List
Remove Nth Node From End of ListGiven 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原创 2015-08-26 21:38:22 · 238 阅读 · 0 评论 -
【LeetCode】之Valid Parentheses
Given a string containing just the characters ‘(‘, ‘)’, ‘{‘, ‘}’, ‘[’ and ‘]’, determine if the input string is valid.The brackets must close in the correct order, “()” and “()[]{}” are all valid but “原创 2015-09-07 09:09:12 · 234 阅读 · 0 评论 -
【LeetCode】之Valid Palindrome
Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example, “A man, a plan, a canal: Panama” is a palindrome. “race a car” is not a palin原创 2015-09-05 21:25:16 · 274 阅读 · 0 评论 -
【LeetCode】之Add Two Numbers
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linke原创 2015-09-03 09:44:35 · 277 阅读 · 0 评论 -
【LeetCode】之Remove Duplicates from Sorted Array II
Follow up for “Remove Duplicates”: What if duplicates are allowed at most twice?For example, Given sorted array nums = [1,1,1,2,2,3],Your function should return length = 5, with the first five elemen原创 2015-09-02 20:30:40 · 218 阅读 · 0 评论 -
【LeetCode】之Remove Duplicates from Sorted Array
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length.Do not allocate extra space for another array, you must do this in place with cons原创 2015-09-02 18:39:05 · 224 阅读 · 0 评论 -
【LeetCode】之Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear only once.For example, Given 1->1->2, return 1->2. Given 1->1->2->3->3, return 1->2->3. 此题目的在于将一个已排好序的链表中重复的节点删除,只保留一个。原创 2015-09-02 11:10:36 · 342 阅读 · 0 评论 -
【LeetCode】之Swap Nodes in Pairs
Swap Nodes in PairsGiven a linked list, swap every two adjacent nodes and return its head.For example, Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only原创 2015-08-26 22:22:11 · 203 阅读 · 0 评论 -
【LeetCode】之Linked List Cycle
Given a linked list, determine if it has a cycle in it.此题目的在于判断一个链表是否是一个循环链表。思路: 1.先定义两个节点指针first和second; 2.first每次走一步,second每次走两步; 3.若second && second->next为NULL,则返回false,此判断是因为如果second为NULL,则 sec原创 2015-08-31 20:32:35 · 221 阅读 · 0 评论 -
【LeetCode】之Evaluate Reverse Polish Notation
Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another expression.Some examples:[“2”, “1”, “+”, “3”, ““] ->原创 2015-09-14 18:25:46 · 196 阅读 · 0 评论