摘要: 题目: The count-and-say sequence is the sequence of integers with the first five terms as following: 1 is read off as "one 1" or 11.11 is read off as "t 阅读全文
posted @ 2018-03-11 22:00 同销万古愁 阅读(171) 评论(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 ident 阅读全文
posted @ 2018-02-27 23:06 同销万古愁 阅读(146) 评论(0) 推荐(0) 编辑
摘要: Determine whether an integer is a palindrome. Do this without extra space. 确定一个整数是否回文数,不能占用额外空间。 (回文数形如121,12321,1221,5等) 大神代码cbmbbz class Solution { 阅读全文
posted @ 2018-02-26 00:08 同销万古愁 阅读(102) 评论(0) 推荐(0) 编辑
摘要: Given a 32-bit signed integer, reverse digits of an integer. 给定一个32位有符号整数,将整数的每位反转,如下: Example 1: Example 2: Example 3: 注意:假设翻转后超出32位有符号数的范围(溢出),那么返回0 阅读全文
posted @ 2018-02-25 22:04 同销万古愁 阅读(106) 评论(0) 推荐(0) 编辑
摘要: Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. 翻译:给出一个包含n个不同数字的数组,数组中元素是从0,1,2, 阅读全文
posted @ 2018-02-22 19:07 同销万古愁 阅读(119) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr 阅读全文
posted @ 2018-02-22 11:59 同销万古愁 阅读(87) 评论(0) 推荐(0) 编辑
摘要: Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. Not 阅读全文
posted @ 2018-02-22 00:22 同销万古愁 阅读(76) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function 阅读全文
posted @ 2018-02-20 18:57 同销万古愁 阅读(105) 评论(0) 推荐(0) 编辑
摘要: Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple 阅读全文
posted @ 2018-02-20 00:25 同销万古愁 阅读(99) 评论(0) 推荐(0) 编辑
摘要: 问题 Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that 阅读全文
posted @ 2018-02-14 18:50 同销万古愁 阅读(96) 评论(0) 推荐(0) 编辑