leetcode [#142]
题目 Given a linked list, return the node where the cycle begins. If there is no cycle, return null. 解决方案12345678910111213141516171819202122232425/** * Definition for singly-linked list. * class List
题目 Given a linked list, return the node where the cycle begins. If there is no cycle, return null. 解决方案12345678910111213141516171819202122232425/** * Definition for singly-linked list. * class List
题目 Sort a linked list using insertion sort. 解决方案12345678910111213141516171819202122232425262728293031323334353637383940/** * Definition for singly-linked list. * public class ListNode { *
题目 Given a linked list, determine if it has a cycle in it. 解决方案12345678910111213141516171819202122232425/** * Definition for singly-linked list. * class ListNode { * int val; * ListNod
题目 Write a function to find the longest common prefix string amongst an array of strings. 解决方案1234567891011121314151617181920212223242526272829303132public class Solution { public String lo
题目 Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 解决方案1234567891011121314151617181920212223242526272829303132333435363738394041424344454
题目 Given an array of integers, every element appears twice except for one. Find that single one. 解决方案123456789101112131415161718import java.util.Hashtable;public class Solution { public int
题目 Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. Example“A man, a plan, a canal: Panama” is a palindrome.“race a car” is not a palindro
题目 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 complete as many transactions as you like (ie, buy o
题目 Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the stock)
题目 Given an index k, return the kth row of the Pascal’s triangle. Example:given k = 3,Return [1,3,3,1]. 解决方案1234567891011121314151617181920212223public class Solution { public List<Integ
题目 Given numRows, generate the first numRows of Pascal’s triangle. Example:given numRows = 5,Return [ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]] 解决方案1234567891011121314151617181920publi
题目 Given an array of integers, return indices of the two numbers such that they add up to a specific target. You may assume that each input would have exactly one solution. Example:Given nums = [2, 7
题目 Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node. 解决方案123456789101112131415161718192
前言 本文对JavaScript中数组类型(Array)的常用方法进行总结,主要包括其API,使用示例和是否直接操作/修改原数组的分析。文章最后会对ECMAScript5中提供的数组方法进行小结。 join()作用 将数组元素衔接为字符串。参数 array.join() array.join(separator) separator: 在返回的拼接字符串中,用以连接原来数组元素的分隔
前言 本篇简单总结cookie的概念,作用,应用,实现案例等要点,关于大段的介绍,就不再重复了,网上有很多可以参考。而且cookie相关是一个很大的话题,这里只是简单小结,主要包括: 1.cookie相关介绍 2.cookie安全性问题 3.javascript对cookie的操作与使用 4.cookie与session的对比分析 5.cookie在实际开发中的使用 直观感受 c
前言 轮播图组件是一种网站中常见的表现形式。常用于广告位,头条新闻等重要信息的展示而且将图片和信息结合起来,引人注意。轮播图最重要的自然是“轮播”,也就是要让页面中的DOM元素“动”起来。这就自然需要先简单提一下JavaScript的运动框架。 JavaScript运动框架简介 JavaScript运动框架就是指利用js和DOM元素配合,利用js的相关函数以一定的频率操作改变DOM元素的位置
关于restful API的设计是一个很重要的问题,这里给出3篇高质量的文章以供参考。RESTful 架构风格概述 RESTful API 编写指南 阮一峰 理解RESTful架构
作用 一句话来讲,这是一种将类数组对象转换为真正数组的方法。很多时候我们会遇到“类数组对象”,比如在操作DOM元素的时候,查询符合某种class的DOM节点会返回一个NodeList,它就是一个类数组对象。真正数组的很多成员方法不能直接用于类数组对象,因此就需要将其转换为真正的数组。 示例123456789Function.prototype.bind = function(context)