自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(77)
  • 资源 (3)
  • 收藏
  • 关注

原创 @PathVariable问题1

使用@PathVariable时可能会遇到的问题

2022-06-09 11:05:19 137

原创 Java自定义类需要重写什么方法使得HashSet的contains方法对其生效

需要同时重写hashCode()和equals(Object obj)方法

2022-04-26 14:01:21 574

原创 最大重叠区间个数--java实现

主要思路来源于下面这个博客:https://blog.csdn.net/qq_42060170/article/details/104241823在细节上,做了一些修改:(1)定义了新的Comparator接口,使之能正确针对左闭右开区间进行排序(2)原文中的Point类对应于本文的Interval类,删除类原文中的Interval类(3)增加了控制台的输入和输出(4)原文...

2020-04-27 15:21:47 2548 1

原创 java实现一个bitmap--《编程珠玑ch1》

/** * 用于排序一个满足以下条件的文件: * (1) 文件中只范围在0~1024*1024*8-1的整数 * (2) 每个数字只出现1次或0次 * 使用到的数组大小: * 约1MB * 排序时间复杂度: * O(n), n为文件中出现的数字总数 */public class BitMap { public static vo...

2020-04-26 15:24:11 215 1

原创 关于LeetCode中Binary Watch一题的理解

题目如下:A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59).Each LED represents a zero or one, with the least significan

2016-09-25 19:36:38 945

原创 关于LeetCode中Valid Parentheses一题的理解

题目如下:Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are

2016-09-22 16:19:55 3534

原创 关于LeetCode中Nth Digit一题的理解

题目如下:Find the nth digit of the infinite integer sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, ...Note:n is positive and will fit within the range of a 32-bit signed integer (n 31).Exampl

2016-09-19 21:52:33 775

原创 关于LeetCode中ZigZag Conversion一题的理解

题目如下:The string "PAYPALISHIRING" is written in a zigzag pattern on a given number of rows like this: (you may want to display this pattern in a fixed font for better legibility)P A H NA P

2016-09-18 18:40:24 783

原创 关于LeetCode中Merge Sorted Array一题的理解

题目如下;Given two sorted integer arrays nums1 and nums2, merge nums2 into nums1 as one sorted array.Note:You may assume that nums1 has enough space (size that is greater or equal to m + n) to

2016-09-17 22:02:44 1373

原创 关于LeetCode中Roman to Integer一题的理解

题目如下:Given a roman numeral, convert it to an integer.Input is guaranteed to be within the range from 1 to 3999.    题目的意思很明确,我们只要知道罗马数字的计算规则就可以写出这道题的答案了,直接看百度百科关于罗马数字的解释就可以,链接在这里:http://bai

2016-09-16 17:56:11 300

原创 <中秋节番外>编程之美之课后练习(一)

今天是中秋假期的第二天,上午打了一上午的炉石,买了30元十包的新手包,毫不意外地啥也没开出来......好了,言归正传。今天的习题是这样的:给定两个正整数(二进制形式表示)A和B,问把A变为B需要改变多少位(bit)?也就是说,整数A和B的二进制表示中有多少位是不同的?    解决这个问题的思路应该分两步走:(1)找到A和B中所有不同的位;(2)将找到的不同的位进行计数。    第

2016-09-16 14:48:10 433

原创 关于LeetCode中House Robber一题的理解

题目如下:You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adj

2016-09-14 23:03:43 832

原创 关于LeetCode中Bulls and Cows的理解

题目如下:You are playing the following Bulls and Cows game with your friend: You write down a number and ask your friend to guess what the number is. Each time your friend makes a guess, you provi

2016-09-13 18:03:43 740

原创 关于LeetCode中Rotate Function一题的理解

题目如下:Given an array of integers A and letn to be its length.Assume Bk to be an array obtained by rotating the arrayA k positions clock-wise, we define a "rotation function" F on A as follo

2016-09-12 20:05:43 406

原创 关于LeetCode中Implement Stack using Queues一题的理解

题目如下:Implement the following operations of a stack using queues.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get the top element.empty() -- Re

2016-09-12 19:00:03 285

原创 关于LeetCode中Integer Replacement一题的理解

题目如下:Given a positive integer n and you can do operations as follow:If n is even, replace n with n/2.If n is odd, you can replace n with either n + 1 orn - 1.What is the minimum number of

2016-09-12 10:51:47 580

原创 关于LeetCode中Minimum Depth of Binary Tree一题的理解

Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest leaf node.

2016-09-11 20:56:06 1444

原创 关于LeetCode中Implement Queue using Stacks一题的理解

题目如下:mplement the following operations of a queue using stacks.push(x) -- Push element x to the back of queue.pop() -- Removes the element from in front of queue.peek() -- Get the front element.

2016-09-10 12:28:30 252

原创 关于LeetCode中Remove Nth Node From End of List一题的理解

题目如下:Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from t

2016-09-09 20:55:23 434

原创 关于LeetCode中Implement strStr()一题的理解

题目如下:Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.    这题干的意思对于我这种英语渣真是有扭头就走的冲动啊,"needle"指的是子串,"haystack"指的是目标串,题干问的

2016-09-09 19:12:00 401

原创 IntelliJ IDEA导入JDK出现The selected directory is not a valid home for JDK问题的解决方法

昨天在实验室的台式机上配置java。之前一直在MAC上都是使用IntelliJ IDEA玩耍,这次也不能少了它。马上上官网下载了一个Windows版的,用学生账号注册完之后,就可以直接进行使用了!但是在导入JDK的时候却遇到了问题,下图是添加JDK的界面:    点击new按钮后出现下图:   点击JDK后出现了这个框框:    你要是随便选一个文件夹的话就会弹出下图的对话

2016-09-09 14:24:54 107674 11

原创 关于LeetCode中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 dayi.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of the

2016-09-09 13:55:36 2951 1

原创 关于LeetCode中Word Pattern一题的理解

题目如下:Given a pattern and a stringstr, find if str follows the same pattern.Here follow means a full match, such that there is a bijection between a letter inpattern and a non-empty word in s

2016-09-08 20:43:04 344

原创 关于LeetCode中Guess Number Higher or Lower一题的理解

题目如下:We are playing the Guess Game. The game is as follows:I pick a number from 1 to n. You have to guess which number I picked.Every time you guess wrong, I'll tell you whether the number i

2016-09-08 13:52:13 2251

原创 关于LeetCode中Isomorphic Strings一题的理解

题目如下:Given two strings s and t, determine if they are isomorphic.Two strings are isomorphic if the characters in s can be replaced to gett.All occurrences of a character must be replaced wit

2016-09-07 18:31:53 1474

原创 关于LeetCode中Linked List Cycle一题的理解

题目如下:Given a linked list, determine if it has a cycle in it.Follow up:Can you solve it without using extra space?     题目的要求是判断一个链表中是否存在环。这个题目我还是想了很久的,最开始的思路是判断随着指针节点移动,其必然会与开始节点即head节点重合,如果重

2016-09-07 16:27:12 484

原创 关于LeetCode中Factorial Trailing Zeroes一题的理解

题目如下:Given an integer n, return the number of trailing zeroes inn!.Note: Your solution should be in logarithmic time complexity    给定一个int类型的整数,求它的阶乘尾部有几个0。举例来说,如果输入是5,那么5!等于120,120尾部有一个0,所以

2016-09-07 13:18:53 274

原创 关于LeetCode中Lowest Common Ancestor of a Binary Search Tree一题的理解

Given a binary search tree (BST), find the lowest common ancestor (LCA) of two given nodes in the BST.

2016-09-06 19:35:20 210

原创 关于LeetCode中Rectangle Area一题的理解

题目如下:Find the total area covered by two rectilinear rectangles in a2D plane.Each rectangle is defined by its bottom left corner and top right corner as shown in the figure.Assume that th

2016-09-05 21:13:52 538

原创 关于LeetCode中Swap Nodes in Pairs一题的理解

题目如下:Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should use only constant spa

2016-09-05 19:46:28 586

原创 关于LeetCode中Longest Common Prefix一题的理解

题目如下:Write a function to find the longest common prefix string amongst an array of strings.    给定一个String类型数组,要求写一个方法,返回数组中这些字符串的最长公共前缀。举个例子:假如数组为["123","12","4"],经过这个方法返回的结果就应该是""。因为"123","12",

2016-09-04 18:33:06 8593 3

原创 关于LeetCode中Remove Linked List Elements一题的理解

题目如下:Remove all elements from a linked list of integers that have value val.ExampleGiven: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val = 6Return: 1 --> 2 --> 3 --> 4 --> 5

2016-09-04 17:23:48 423

原创 关于LeetCode中Palindrome Linked List一题的理解

题目如下:Given a singly linked list, determine if it is a palindrome.Follow up:Could you do it in O(n) time and O(1) space?    题目还是很简单,判断一个链表是不是“回文链表”。然后稍微难一点的是是否能够用O(n)的时间复杂度和O(1)空间复杂度完成这个方

2016-09-03 23:09:13 354

原创 关于LeetCode中Symmetric Tree一题的理解

题目如下:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree [1,2,2,3,4,4,3] is symmetric: 1 / \ 2 2 / \ / \

2016-09-03 16:54:06 1238

原创 关于LeetCode中Reverse Vowels of a String一题的理解

题目如下:Write a function that takes a string as input and reverse only the vowels of a string.Example 1:Given s = "hello", return "holle".Example 2:Given s = "leetcode", return "leotced

2016-09-02 22:54:27 288

原创 关于LeetCode中Remove Element一题的理解

题目如下:Given an array and a value, remove all instances of that value in place and return the new length.Do not allocate extra space for another array, you must do this in place with constant

2016-09-02 21:05:59 1382 2

原创 关于LeetCode中Remove Duplicates from Sorted List一题的理解

题目如下:Given a sorted linked list, delete all duplicates such that each element appear only once.For example,Given 1->1->2, return 1->2.Given 1->1->2->3->3, return 1->2->3.    这道题还是很有意思的

2016-09-02 17:47:38 323

原创 关于LeetCode中First Unique Character in a String一题的理解

题目如下:Given a string, find the first non-repeating character in it and return it's index. If it doesn't exist, return -1.Examples:s = "leetcode"return 0.s = "loveleetcode",return 2.

2016-09-01 14:10:27 417

原创 关于LeetCode中Valid Palindrome一题的理解

题目如下:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Panama" is a palindrome."race a car

2016-08-31 18:50:25 460

原创 关于LeetCode中Excel Sheet Column Title一题的理解

题目如下:Given a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB

2016-08-31 18:01:16 388

哈工大密码学实验(一)维吉尼亚密码加密解密及破解

哈工大密码学实验一,包括维吉尼亚密码的加密解密及用卡西斯基的破解

2015-03-30

python灰帽子 中文版

一本不可多得的python神书,值得一看。主要介绍了python在网络安全领域的应用

2015-03-23

java concurrent in practice

非常好的英文java并发编程教材 中文版实在翻译的呵呵 所以上传英文版

2015-03-23

空空如也

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

TA关注的人

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