12 2016 档案
摘要:Problem: 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
阅读全文
摘要:Problem: 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 ar
阅读全文
摘要:Problem: 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
阅读全文
摘要:Problem: Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements o
阅读全文
摘要:Problem: Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j]
阅读全文
摘要:Problem: Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Return Summary: 输出杨辉三角的前n行。 Solution: 方法类似于Lee
阅读全文
摘要:Problem: Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [1,3,3,1]. Note:Could you optimize your algori
阅读全文
摘要:Problem: 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 woul
阅读全文
摘要:Problem: Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time
阅读全文
摘要:Problem: Given a non-empty string check if it can be constructed by taking a substring of it and appending multiple copies of the substring together.
阅读全文
摘要:Problem: Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child
阅读全文
摘要:Problem: You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizo
阅读全文
摘要:Problem: Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those lett
阅读全文
摘要:Problem: Find the sum of all left leaves in a given binary tree. Summary: 求左子叶之和。 Analysis: 1. 求左子叶之和,即需要遍历整棵二叉树,常规的方法则为递归。首先我想到的是调用子函数,在子函数中递归,每递归至一个
阅读全文

浙公网安备 33010602011771号