LeetCode Remove Element
Problem 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 m...
Problem 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 m...
Problem Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space for another array, you must do this in ...
Problem Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. 即合并两个已经排好序的链表。并且要求返回的新链表是由原两个链表元素组合而成的。链表的结构定...
Problem 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 ...
Problem Write a function to find the longest common prefix string amongst an array of strings. 就是找出一个字符串数组中元素,最长的通用前缀。例如:{“ab”,”abc”,”abd”},答案是 “ab”。 Java 实现 package com.coderli.leetcode.alg...
Problem Given an integer, convert it to a roman numeral. Input is guaranteed to be within the range from 1 to 3999. 跟Roman To Integer是对应问题。即将整数转换成对应的罗马数字。罗马数字规则见wiki:罗马数字规则 Java 实现(个人解法) pa...
Problem Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999. 即将罗马数字1-3999转换成对应的整数。罗马数字规则见wiki:罗马数字规则 Java 实现 /** * Given a roman nume...
Problem Determine whether an integer is a palindrome. Do this without extra space. 即返回一个数是否是回数。例如:1,1221,12321是回数,负数不是回数。题目特别提醒,不要使用额外的空间,即不要考虑转换成String来处理。 Java 实现 /** * Determine whether ...
Problem Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 Note: The input is assumed to be a 32-bit signed integer. Your function should return 0 when t...
研究背景 上篇(Httpcomponents-core 从池中获取连接代码解析)研究中,我们知道,Httpcomponents-client底层维护了一个socket连接池,对于同一个地址,默认只可以建立2个连接。如果连接不及时释放,就会造成连接池中无可用的连接获取,从而导致请求等待(阻塞)。因此,我们需要关注连接池释放的逻辑。 释放方式 一个比较常见的方式就通过EntityUti...