Problem: 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 ...
分类:
其他好文 时间:
2016-10-30 07:20:56
阅读次数:
222
给数组赋值:通过fill方法。 对数组排序:通过sort方法,按升序。 比较数组:通过equals方法比较数组中元素值是否相等。 查找数组元素:通过binarySearch方法能对排序好的数组进行二分查找法操作。 ...
分类:
编程语言 时间:
2016-10-30 07:15:00
阅读次数:
157
Problem: Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice i ...
分类:
其他好文 时间:
2016-10-30 07:13:52
阅读次数:
160
数组 检测数组: function typeof( obj ) { if(typeof Array.isArray "function"){ return Array.isArray(obj) }else{ return Object.prototype.toString.call ( obj ) ...
分类:
编程语言 时间:
2016-10-30 07:08:59
阅读次数:
197
import java.lang.reflect.Array; /* 具体原理在c++版已经说的很清楚,这里不再赘述, 就提一点:java的泛型具有边界效应,一旦离开作用域立马被替换为object类型,在new泛型数组需要借助反射。 */ interface BaseStack<T>{ boolea ...
分类:
编程语言 时间:
2016-10-30 00:48:33
阅读次数:
195
今天学了string对象,array对象,Date对象。 String对象: 创建String对象:第一种:使用单引号和双引号定义的字符串变量 那么它就是一个字符串对象 var 变量名 ="字符串" 第二种:使用new关键字和String()方法来创建 var 变量名 =new Srting() 属 ...
分类:
其他好文 时间:
2016-10-30 00:18:17
阅读次数:
170
【原】十分钟搞定pandas 本文是对pandas官方网站上《10 Minutes to pandas》的一个简单的翻译,原文在这里。这篇文章是对pandas的一个简单的介绍,详细的介绍请参考:Cookbook 。习惯上,我们会按下面格式引入所需要的包: 一、 创建对象 可以通过 Data Stru ...
分类:
其他好文 时间:
2016-10-29 19:29:12
阅读次数:
155
当app出现崩溃, 研发阶段一般可以通过以下方式来跟踪crash信息 #1.模拟器运行, 查看xcode错误日志 #2.真机调试, 查看xcode错误日志 #3.真机运行, 查看device系统日志 下面举例说明, 先写一段会Crash的代码crashdemo: Demo#1.模拟器运行, 查看xc ...
分类:
移动开发 时间:
2016-10-29 14:49:54
阅读次数:
581
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 ...
分类:
其他好文 时间:
2016-10-29 14:43:18
阅读次数:
196
冒泡排序 简介 冒泡排序是一种简单的排序算法,属于暴力算法的一种。基本思想是通过比较相邻的元素,并将其有序化而逐步将整个序列有序化。 伪代码 procedure bubble sort(A1, A2,....,An: 整数) for(i from 1 to n - 1) for(j from i + ...
分类:
编程语言 时间:
2016-10-29 14:35:12
阅读次数:
245