02 2018 档案
摘要: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
阅读全文
摘要:Determine whether an integer is a palindrome. Do this without extra space. 确定一个整数是否回文数,不能占用额外空间。 (回文数形如121,12321,1221,5等) 大神代码cbmbbz class Solution {
阅读全文
摘要:Given a 32-bit signed integer, reverse digits of an integer. 给定一个32位有符号整数,将整数的每位反转,如下: Example 1: Example 2: Example 3: 注意:假设翻转后超出32位有符号数的范围(溢出),那么返回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,
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要: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
阅读全文
摘要:问题 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
阅读全文
摘要:和前面119. Pascal's Triangle非常相似,不赘述,下面是代码 class Solution { public List<Integer> getRow(int row) { List<Integer> yanghui=new ArrayList<Integer>(); for (i
阅读全文
摘要:Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array. Note:You may assume that nums1 has enough space (size tha
阅读全文