摘要: 题目描述: Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close i 阅读全文
posted @ 2017-12-29 16:11 zlz099 阅读(104) 评论(0) 推荐(0)
摘要: 题目描述: Given two binary trees, write a function to check if they are the same or not. Two binary trees are considered the same if they are structurally 阅读全文
posted @ 2017-12-29 16:08 zlz099 阅读(116) 评论(0) 推荐(0)
摘要: 题目描述: 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- 阅读全文
posted @ 2017-12-29 16:07 zlz099 阅读(112) 评论(0) 推荐(0)
摘要: 题目描述: You are climbing a stair case. It takes n steps to reach to the top. Each time you can either climb 1 or 2 steps. In how many distinct ways can 阅读全文
posted @ 2017-12-29 16:05 zlz099 阅读(113) 评论(0) 推荐(0)
摘要: 题目描述: Given a non-negative integer represented as a non-empty array of digits, plus one to the integer. You may assume the integer do not contain any 阅读全文
posted @ 2017-12-29 16:04 zlz099 阅读(123) 评论(0) 推荐(0)
摘要: 题目描述: Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the las 阅读全文
posted @ 2017-12-29 16:03 zlz099 阅读(114) 评论(0) 推荐(0)
摘要: 题目描述: Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted 阅读全文
posted @ 2017-12-29 16:01 zlz099 阅读(117) 评论(0) 推荐(0)
摘要: 题目描述: Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. Example 1: Example 阅读全文
posted @ 2017-12-29 16:00 zlz099 阅读(146) 评论(0) 推荐(0)
摘要: 题目描述: Given an array and a value, remove all instances of that value in-place and return the new length. Do not allocate extra space for another array 阅读全文
posted @ 2017-12-29 15:58 zlz099 阅读(113) 评论(0) 推荐(0)
摘要: 题目描述: 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 sp 阅读全文
posted @ 2017-12-29 15:57 zlz099 阅读(141) 评论(0) 推荐(0)
摘要: 题目描述: 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. Ex 阅读全文
posted @ 2017-12-29 15:55 zlz099 阅读(116) 评论(0) 推荐(0)
摘要: 题目描述: Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 思路: 罗马数字转int 遍历string,如果左边大于右边,则加上右边 阅读全文
posted @ 2017-12-29 15:52 zlz099 阅读(122) 评论(0) 推荐(0)
摘要: 题目描述: Determine whether an integer is a palindrome. Do this without extra space. 思路:检测是不是回文数。将给定的数翻转即可。与第七题的思路相同,网上给的解法是从头和尾同时遍历,比较是否相等,相等则删除继续比较,直到最中 阅读全文
posted @ 2017-12-29 15:51 zlz099 阅读(127) 评论(0) 推荐(0)
摘要: 题目描述: Given a 32-bit signed integer, reverse digits of an integer. Example 1: Example 2: Example 3: Note:Assume we are dealing with an environment whi 阅读全文
posted @ 2017-12-29 15:49 zlz099 阅读(102) 评论(0) 推荐(0)
摘要: 题目描述: Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would h 阅读全文
posted @ 2017-12-29 15:46 zlz099 阅读(105) 评论(0) 推荐(0)