int

42. Trapping Rain Water

题目: Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. For example, Given [0,1,0,2,1,0,1

157. Read N Characters Given Read4

题目: The API: int read4(char *buf) reads 4 characters at a time from a file. The return value is the actual number of characters read. For example, it returns 3 if there is only 3 character

370. Range Addition

题目: Assume you have an array of length n initialized with all 0's and are given k update operations. Each operation is represented as a triplet: [startIndex, endIndex, inc] which increment

276. Paint Fence

题目:There is a fence with n posts, each post can be painted with one of the k colors.You have to paint all the posts such that no more than two adjacent fence posts have the same color.Retu

343. Integer Break

题目:Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get.For example, given

354. Russian Doll

典型的dp,注意点的程序中已经标出: public class Solution { //State: Sort envelopes' width, f[i] is maximum number of envelopes number i envelope can get; //Function: f[i] = Math.max(f[i - k] + 1) if Size(

[Leetcode] Pascal's Triangle II 杨辉三角

Pascal's Triangle II Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3, Return [1,3,3,1]. 从后往前覆盖法 复杂度 O(N) 时间 O(K) 空间 思路 一行一行地迭代,后面一行迭代覆盖前一行,窍门是:从后往前算

260. Single NumberIII

题目: Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once. For example

268. Missing Number

题目: Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array. For example, Given nums = [0, 1, 3] return 2. Note: Your algorithm

Android 开发中应该知道的关于strings.ml的事

本文主要讲解Android开发中常见的strings.xml的使用技巧。原文地址笔者的Android系列文章避免过度复用不要复用不同页面上的字符串1.假设你现在在Sign In与Sign Up两个界面上都设置了一个加载提示框,因为两个都是用于提示正在加载中的,因此你打算使用相同的提示语 —— R.string.loading不过后来PM说这样实在太不友好了,因此你打算用两个