1、去掉重复的数组元素。2、获取一个数组中的重复项。3、求一个字符串的字节长度,一个英文字符占用一个字节,一个中文字符占用两个字节。4、判断一个字符串中出现次数最多的字符,统计这个次数。5、数组排序。6、快排。7、删除/添加数组项。8、数组随机顺序输出。9、数组求和、最大值。10、判断是否为数组。1...
分类:
Web程序 时间:
2014-06-29 13:41:49
阅读次数:
363
原题地址:https://oj.leetcode.com/problems/anagrams/题意:Given
an array of strings, return all groups of strings that are anagrams.Note: All
inputs will be i...
分类:
编程语言 时间:
2014-06-29 13:25:28
阅读次数:
355
先看一段比较神奇的运算和他的结果:{}+[]//0[]+{}//"[object
Object]"{}+[] == []+{}//false({}+[]) ==
[]+{}//true运算结果不一样,很神奇啊。。。我们来看一下js中对Object和Array直接执行运算时会发生什么。由于数组不是一个...
分类:
Web程序 时间:
2014-06-29 07:50:50
阅读次数:
267
题目链接 Given an unsorted integer array, find the
first missing positive integer. For example, Given [1,2,0] return 3, and
[3,4,-1,1] return 2. Your algo...
分类:
其他好文 时间:
2014-06-29 07:44:48
阅读次数:
321
在一个经过旋转后的有序数组中查找一个目标元素。
Suppose a sorted array is rotated at some pivot unknown to you beforehand.
(i.e., 0 1 2 4 5 6 7 might become 4
5 6 7 0 1 2).
You are given a target value to search...
分类:
其他好文 时间:
2014-06-20 13:06:31
阅读次数:
261
1 Android手机目前常见的分辨率
1.1 手机常见分辨率:
4:3
VGA 640*480 (Video Graphics Array)
QVGA 320*240 (Quarter VGA)
HVGA 480*320 (Half-size VGA)
SVGA 800*600 (Super VGA)
5:3
WVGA 800*480 (Wide VGA)
...
分类:
移动开发 时间:
2014-06-20 12:50:23
阅读次数:
271
题目
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.
方法
数组是有序的,要求创建的二叉树尽量平衡,很容易想到对数组进行二分操作,左边的数组元素是左子树,右边的数组元素是右子树。进行递归操作就可以了。
TreeNode...
分类:
其他好文 时间:
2014-06-20 11:06:46
阅读次数:
257
用bit mask来做枚举还挺方便的这个大概是给你一个vector
array,求出这个array里任意几个元素加和所不能得到最小的整数。元素个数最大20个,每个元素不超过100000比如[1,2,4],那么就应该返回8.
(因为3=1+1, 5=1+4等等)所以枚举这个array的所有子集求和,之...
分类:
其他好文 时间:
2014-06-05 17:25:52
阅读次数:
246
//类型修饰符 数组名[数组元素个数] = {初始化}; //定义数组的时候[]中必须是常量表达式,
不可以是变量; /* int age[5] = {21, 18, 25, 20, 18}; int array[10] = {0};//代表数组中有10个元素,
每个都是0; int a...
分类:
编程语言 时间:
2014-06-05 16:29:09
阅读次数:
355
Given an array of integers, find two numbers
such that they add up to a specific target number.The function twoSum should
return indices of the two nu...
分类:
其他好文 时间:
2014-06-05 14:15:07
阅读次数:
221