- 博客(15)
- 收藏
- 关注
原创 leetcode-42 Trapping Rain Water
Givennnon-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining.The above elevation map is represented by array...
2019-04-30 16:58:31 96
原创 leetcode-41 First Missing Positive
Given an unsorted integer array, find the smallest missingpositive integer.Example 1:Input: [1,2,0]Output: 3Example 2:Input: [3,4,-1,1]Output: 2Example 3:Input: [7,8,9,11,12]Outpu...
2019-04-30 15:10:30 131
原创 leetcode-40 Combination Sum II
Given a collection of candidate numbers (candidates) and a target number (target), find all unique combinations incandidateswhere the candidate numbers sums totarget.Each number incandidatesmay...
2019-04-29 19:21:11 71
原创 leetcode-39 Combination Sum
Given asetof candidate numbers (candidates)(without duplicates)and a target number (target), find all unique combinations incandidateswhere the candidate numbers sums totarget.Thesamerepeat...
2019-04-29 16:25:15 69
原创 leetcode-38 Count and Say
The count-and-say sequence is the sequence of integers with the first five terms as following:1. 12. 113. 214. 12115. 1112211is read off as"one 1"or11.11is read off ...
2019-04-29 14:56:17 127
原创 leetcode-37 Sudoku Solver
Write a program to solve a Sudoku puzzle by filling the empty cells.Asudoku solution must satisfyall ofthe following rules:Each of the digits1-9must occur exactlyonce in each row. Each of t...
2019-04-28 14:12:36 108
原创 leetcode-36 Valid Sudoku
Determine if a9x9 Sudoku boardis valid.Only the filled cells need to be validatedaccording to the following rules:Each rowmust contain thedigits1-9without repetition. Each column must conta...
2019-04-26 14:07:14 80
原创 leetcode-35 Search Insert Position
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in order.You may assume no duplicates in the array....
2019-04-25 22:03:46 80
原创 leetcode-34 Find First and Last Position of Element in Sorted Array
Given an array of integersnumssorted in ascending order, find the starting and ending position of a giventargetvalue.Your algorithm's runtime complexity must be in the order ofO(logn).If the...
2019-04-25 21:12:16 79
原创 leetcode-33 Search in Rotated Sorted Array
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.(i.e.,[0,1,2,4,5,6,7]might become[4,5,6,7,0,1,2]).You are given a target value to search. If found ...
2019-04-25 19:31:32 86
原创 LinkedHashMap源码分析
public class LinkedHashMap<K,V> extends HashMap<K,V> implements Map<K,V>继承HashMap 并实现了Map的接口其中HashMap用Node<K,V>[] table;实现了桶,即相当于用数组实现了 List(类似于arraylist)那么Linked...
2019-04-17 22:56:26 111
原创 HashMap源码解析
HashMap<K, V>集成了AbstractMap<K, V>,并实现Map<K, V>, Cloneable, Serializable接口其中接口Map<K,V>中含有大量default修饰的 方法体如:default V getOrDefault(Object var1, V var2) { Object var...
2019-04-17 21:10:03 186
原创 HashMap源码解析-关于二叉树和红黑树
二叉树:用java基本代码可以表示为(掌握遍历算法 前序,中序,后续 熟练使用递归)publicclass TreeNode { // 左节点 private TreeNode lefTreeNode; // 右节点 private TreeNode rightNode; // 当前结点的值 private int value; ...
2019-04-17 21:09:39 2335
原创 Oracle jdbc读取为UTF-8字符 导致乱码问题(上篇之对jdbc进行回顾,本文以ojdbc8进行分析)
在oracle的ojdbc8中调用getString()乱码,如何解决?会默认转为UTF-8格式导致??当数据库为ascii7字符集首先对java连接数据库,进行再一次的巩固,大致分为以下步骤:(本文以oracle为例) 第一步Class.forName("jdbc.driver");,通过反射进行加载,链接,初始化该类,该过程对类中的static方法等,进行加载。...
2019-04-11 19:56:21 2559
原创 Oracle jdbc读取为UTF-8字符 (ojdbc8中代码bug)导致乱码问题-下
首先我们在获取返回的数据 首先初始化一系列数据为每一列的列属性进行配置 如列名等然后是对Oracle返回的数据进行获取,我们对ojdbc6和ojdbc8进行比较Ojdbc6中在此处,获取到数据库返回的byte[]数组,为GBK类型这一步 获取 byte[]数组接着将获取到的byte数组 变为java中的char 放置在rowspacehchar中 再get...
2019-04-08 16:39:52 4271 1
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人