Algorithm
Hsueh YH
这个作者很懒,什么都没留下…
展开
-
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]原创 2017-05-20 17:17:51 · 245 阅读 · 0 评论 -
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原创 2017-05-20 12:30:21 · 187 阅读 · 0 评论 -
Palindrome Linked List
Given a singly linked list, determine if it is a palindrome. 注解:用快慢指针找出中间节点,将后半链表倒序,对比每个节点 bool isPalindrome(ListNode* head) { if( !head || !head->next ) return true;原创 2017-05-20 12:12:10 · 230 阅读 · 0 评论 -
Palindrome Number
Determine whether an integer is a palindrome. Do this without extra space. 注解:主要考虑越界问题 解1:把数分为左右两部分,右半块高低位颠倒 bool isPalindrome(int x) { if( x 0 && x % 10 == 0) ) return false;原创 2017-05-20 12:04:29 · 210 阅读 · 0 评论 -
Build Palindrome
Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters. This is case sensitive, for example "Aa" is not con原创 2017-05-20 11:25:26 · 313 阅读 · 0 评论 -
House Robber
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent house原创 2017-05-20 17:28:03 · 263 阅读 · 0 评论 -
House Robber II (houses are arranged in a circle)
题目描述: After robbing those houses on that street, the thief has found himself a new place for his thievery so that he will not get too much attention. This time, all houses at this place are arrange原创 2017-05-20 17:53:01 · 284 阅读 · 0 评论