有时在显示某段文字的时候,可能会太长,影响我们页面的显示效果。如果仅是英文,那么我们可以用String.substring(start, end)函数就已经够用了。但是通常我们都会遇到既有英文,又有汉字的情况。而汉字是占用2个字节的,如果用String.substring(start, end)截取...
分类:
编程语言 时间:
2014-11-17 21:18:11
阅读次数:
184
Wi-Fi peer-to-peer(P2P,对等网络),它允许具备相应硬件的Android 4.0(API level 14)或者更高版本的设备可以直接通过wifi而不需要其它中间中转节点就能直接通信(Android的Wi-Fi P2P框架符合Wi-Fi联盟的Wi-Fi Direct?直连认证标志)。使用这些API,你可以搜索并连接其它同样支持Wi-Fi P2P的设备,然后再通过一个高速的连接进...
分类:
移动开发 时间:
2014-11-17 19:29:32
阅读次数:
280
3517.The longest athletic trackTime Limit:1.0 Seconds Memory Limit:65536KTotal Runs:880 Accepted Runs:342After a long time of algorithm training, we w...
分类:
其他好文 时间:
2014-11-17 11:59:05
阅读次数:
270
Longest Ordered Subsequence
Time Limit: 2000MS
Memory Limit: 65536K
Total Submissions: 34454
Accepted: 15135
Description
A numeric sequence of ai is ordered if a1 a2 ...
分类:
其他好文 时间:
2014-11-16 18:41:55
阅读次数:
202
【题目】
Given a string s, partition s such that every substring of the partition is a palindrome.
Return the minimum cuts needed for a palindrome partitioning of s.
For example, given s = "aab...
分类:
其他好文 时间:
2014-11-16 17:23:33
阅读次数:
158
【题目】
Given a string s, partition s such that every substring of the partition is a palindrome.
Return all possible palindrome partitioning of s.
For example, given s = "aab",
Return
[
...
分类:
其他好文 时间:
2014-11-16 17:22:42
阅读次数:
176
C#中String类的几个方法(IndexOf、LastIndexOf、Substring)
给定两个串,S和T,在S中找到包含T的最短子串,如果不能包含,返回空字符。Given a string S and a string T, find the minimum window in S which will contain all the characters in T in compl...
可能是因为我是按难度顺序刷的原因,这个其实在之前的几道题里面已经写过了。题目如下: Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path...
分类:
其他好文 时间:
2014-11-15 21:31:17
阅读次数:
194
有n种重量和价值分别为wi,vi的物品。从这些物品中挑选总重量不超过W的物品,求出挑选物品价值总和的最大值。每种物品可以挑选任意多件。令dp[i+1][j]:=从前i种物品中挑选总重量不超过j时总价值的最大值。那么递推关系为:根据递推关系编写代码: 1 void solve() 2 { 3 ...
分类:
其他好文 时间:
2014-11-15 18:39:53
阅读次数:
233