码迷,mamicode.com
首页 >  
搜索关键字:length    ( 19575个结果
Leetcode: Longest Substring Without Repeating Characters
1 public class Solution { 2 public int lengthOfLongestSubstring(String s) { 3 int length = s.length(); 4 if (length == 0) return ...
分类:其他好文   时间:2014-06-13 08:31:32    阅读次数:214
LeetCode——Remove Element
Given an array and a value, remove all instances of that value in place and return the new length. The order of elements can be changed. It doesn't matter what you leave beyond the new length. 中...
分类:其他好文   时间:2014-06-10 18:41:04    阅读次数:191
LeetCode——Length of Last Word
Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the last word does not exist, return 0. Note: A word is...
分类:其他好文   时间:2014-06-10 10:52:03    阅读次数:180
可变长度子网掩码和无类域间路由
VLSM (Variable Length Subnet Mask:可变长子网掩码)        VLSM的定义:为了有效的使用无类别域间路由(CIDR)和路由汇总来控制路由表的大小,网络管理员使用先进的IP寻址技术,VLSM就是其中的常用方式。        VLSM的作用:在类的IP地址的基础上,从主机号部分借出相应的位数来做网络号,也就是增加网络号的位数。使用可变长度子网掩码的目的,就...
分类:其他好文   时间:2014-06-10 06:24:20    阅读次数:265
调整数组顺序使奇数位于偶数前面
1.维护两个指针,一个指向第一个 ,向右移动,一个指向最后一个元素,向左移动。当第一个指针指向为偶数,第二个为奇数,就进行交换并移动指针。 注意:当输入为Null或者length=0时候的情况。#include "stdafx.h"#include using namespace std;void ...
分类:其他好文   时间:2014-06-09 21:20:21    阅读次数:224
LeetCode:Substring with Concatenation of All Words
You are given a string, S, and a list of words, L, that are all of the same length. Find all starting indices of substring(s) in S that is a concatena...
分类:其他好文   时间:2014-06-09 17:49:34    阅读次数:240
手机正则写法
$.validator.addMethod("cnphone", function(value, element, params) { var length = value.length; var mobile = /^(((1(3|4|5|7|8)[0-...
分类:移动开发   时间:2014-06-09 17:48:49    阅读次数:222
链表中倒数第K个结点
题目:输入一个链表,输出改链表倒数第K个结点。分析:常规方法可能就是,先遍历一遍链表,找到链表长度length,那么我们只需要第二次遍历length-k+1个结点就可以找到倒数第k个结点。 比较好的方法是采用两个指针,让一个指针先走K-1步,后面的指针再跟上。这样只需要遍历一遍。注意:1.提高...
分类:其他好文   时间:2014-06-09 16:35:50    阅读次数:396
JS笔试题
1,考察thisvar length = 10function fn(){ alert(this.length)}var obj = { length: 5, method: function(fn) { fn() // ? arguments[0]()...
分类:Web程序   时间:2014-06-09 16:31:11    阅读次数:293
Network | CIDR
无类别(现在)无类别域间路由(Classless Inter-Domain Routing、CIDR)是一个用于给用户分配IP地址以及在互联网上有效地路由IP数据包的对IP地址进行归类的方法。CIDR用可变长子网掩码 (VLSM,Variable Length Subnet Masking),根据各...
分类:Web程序   时间:2014-06-09 13:14:04    阅读次数:389
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!