自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(24)
  • 收藏
  • 关注

转载 如何解决哈希冲突

就不自己写了,直接贴下吧看了ConcurrentHashMap的实现, 使用的是拉链法.虽然我们不希望发生冲突,但实际上发生冲突的可能性仍是存在的。当关键字值域远大于哈希表的长度,而且事先并不知道关键字的具体取值时。冲突就难免会发 生。另外,当关键字的实际取值大于哈希表的长度时,而且表中已装满了记录,如果插入一个新记录,不仅发生冲突,而且还会发生溢出。因此,处理冲突和溢出是 哈希技术中的两个重要问题

2016-05-31 11:10:44 345

原创 leetcode 350. Intersection of Two Arrays II

题目内容 Given two arrays, write a function to compute their intersection.Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2, 2].Note:Each element in the result should appear as many times a

2016-05-31 09:56:47 402

原创 二叉树的前序遍历,中序遍历,后序遍历代码

前序遍历/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */public class Solution

2016-05-30 23:26:42 777

原创 leetcode 145. Binary Tree Postorder Traversal

题目内容 Given a binary tree, return the postorder traversal of its nodes’ values.For example: Given binary tree {1,#,2,3},1 \ 2 / 3return [3,2,1].Note: Recursive solution is trivial,

2016-05-30 23:22:04 240

原创 leetcode 347. Top K Frequent Elements

题目内容 Given a non-empty array of integers, return the k most frequent elements.For example, Given [1,1,1,2,2,3] and k = 2, return [1,2].Note:You may assume k is always valid, 1 ≤ k ≤ number of unique

2016-05-27 11:44:05 418

原创 leetcode 349. Intersection of Two Arrays

题目内容 Given two arrays, write a function to compute their intersection.Example: Given nums1 = [1, 2, 2, 1], nums2 = [2, 2], return [2].Note:Each element in the result must be unique.The result can b

2016-05-26 22:57:39 266

原创 leetcode 319. Bulb Switcher

题目内容 There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every third bulb (turning on if it’s off or turnin

2016-05-25 17:50:05 291

原创 leetcode 94. Binary Tree Inorder Traversal

题目内容 Given a binary tree, return the inorder traversal of its nodes’ values.For example: Given binary tree {1,#,2,3},1 \ 2 / 3return [1,3,2].Note: Recursive solution is trivial, c

2016-05-24 17:18:35 269

原创 leetcode 260. Single Number III

题目内容 Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements that appear only once.For example:Given nums

2016-05-24 16:23:38 215

原创 leetcode 144. Binary Tree Preorder Traversal

题目内容Given a binary tree, return the preorder traversal of its nodes’ values. For example: Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,2,3].Note: Recursive solution

2016-05-23 11:44:30 239

原创 java 容器总结

java提供了一套完整的容器类:List,Set,Queue,Map。 按照用途的不同将其划分为两个概念,Collection 和 MapCollection :一个独立元素的序列,这些元素服从一条或者多条规则。List 必须按照插入顺序保存元素;Set 不能有重复元素;Queue 按照排队规则来确定对象产生的顺序。map:一组成对的“键值对”对象,允许使用键来查找值。这种映射关系使得我们能够

2016-05-23 10:32:06 266

原创 leetcode 268. Missing Number

题目内容 Given an array containing n distinct numbers taken from 0, 1, 2, …, n, find the one that is missing from the array.For example, Given nums = [0, 1, 3] return 2.Note: Your algorithm should run

2016-05-19 16:01:27 207

原创 leetcode 238. Product of Array Except Self

题目内容 Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except nums[i].Solve it without division and in O(n

2016-05-18 17:50:24 253

原创 leetcode 122. Best Time to Buy and Sell Stock II

题目内容 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

2016-05-16 23:38:19 243

原创 leetcode 121. Best Time to Buy and Sell Stock

题目内容 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)

2016-05-16 16:11:23 162

原创 验证码安全问题汇总(实例版)

这是一篇非常好的实战文,用来破解验证码,文里面有很多wooyun中的案例 验证码安全问题汇总转载需要权限,懒得申请,放到这里,自己找着方便。传送门点击上面蓝色链接,网址如下,www.91ri.org/12611.html

2016-05-16 11:13:28 449

转载 验证码设计中常见的安全问题

本文非原创,摘自网页 验证码设计中常见的安全问题验证码的英文缩写是CAPTCHA,即:Completely Automated Public Turing test to tell Computers and Humans Apart译作”全自动人机区分的图灵测试”。时下图形验证码的应用已经非常广泛了,无论是在web应用还是客户端软件中。主要是用来防止字典攻击(或称暴力猜解)、机器注册等。可惜的是,

2016-05-16 10:51:02 1496

原创 leetcode 137. Single Number II

题目内容 Given an array of integers, every element appears three times except for one. Find that single one.Note: Your algorithm should have a linear runtime complexity. Could you implement it without u

2016-05-13 11:25:57 274

原创 位运算总结,&,|,^,~,>>,<<

位运算操作符介绍& 按位与| 按位或^ 按位异或~ 按位取反>> 按位右移<< 按位左移& 运算符 a&b是将两个表达式的值按二进制位展开,对应的位(bit)按值进行“与”运算,结果保留在该位上。如果两数位数不同,则较短数高位补零,再运算。 9&8 转换成二进制 1001 &1000结果是1000 |

2016-05-12 17:40:52 466

原创 leetcode 343. Integer Break

题目内容 Given a positive integer n, break it into the sum of at least two positive integers and maximize the product of those integers. Return the maximum product you can get.For example, given n = 2, r

2016-05-10 21:21:15 316

原创 LeetCode 142. Linked List Cycle II

题目内容 Given a linked list, return the node where the cycle begins. If there is no cycle, return null. 题目分析 在141题的基础上,加入了寻找出了环的起点位置,如果有环找出起点,没有环返回null。 找出环的起点,当找到确定有环以后,讲fast标记回head结点,然后步长调整为1,当再次与

2016-05-10 17:49:16 216

原创 leetcode 141. Linked List Cycle

题目内容 Given a linked list, determine if it has a cycle in it. 题目分析 判断一个链表是否有环, 设置fast和slow两个flag,当fast和slow相遇以后就证明有环 具体证明 点击这里/** * Definition for singly-linked list. * class ListNode { *

2016-05-10 16:47:19 238

原创 leetcode 344. Reverse String 题解

题目描述 Write a function that takes a string as input and returns the string reversed.Example: Given s = “hello”, return “olleh”. 题目分析 这是一道水题,唯一的坑点是可能字符串 s 过长。如果定义变量 String ss+=s.charAt(n),这样的写法会造成超时。s

2016-05-09 17:01:12 413

原创 ipython notebook报错

好久没有用notebook了,然后打开以前的文件突然连不到服务器了,报错内容ERR_CONNECT_FAIL 终端显示的内容是 看到了 0 active kernels 在StackOverFlow 上搜了一下,英语太渣没看懂,只是记得url和之前的不一样将url 改为,http://127.0.0.1:8888/ 就可以了。。。 good luck

2016-05-05 17:52:39 864

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除