- 博客(22)
- 收藏
- 关注
原创 Java小总结之Final篇
final作为Java中一个很常见的关键字,可以用于声明在数据、方法、类上。用通俗的一句话将,用final关键字修饰的东西,那么它指向的东西就是不可变的。final的基础上使用类final用在类上,就表示这个类是不能继续继承的了,没有子类。final类中所有方法也都是隐式final,也就没有必要对每个方法添加final关键字了。这里来了个问题,如果要拓展final类型的类,又不能继承,那怎么办?那就不用继承,用组合来实现:class FinalString{ private String
2021-10-17 18:16:28 304
原创 Java关键字volatile篇小总结
volatile篇小总结volatile的作用防止指令重排序实现变量的可见性保证单次的读/写具有原子性volatile保证可见性的demo:public class VolatileDemo { int a = 1; int b = 2; public void change() { a = 3; b = a; } public void print() { System.out.println("a
2021-10-14 00:41:48 155
原创 Leetcode 216 组合总和III
Leetcode 216 组合总和III题目描述找出所有相加之和为 n 的 k 个数的组合**。**组合中只允许含有 1 - 9 的正整数,并且每种组合中不存在重复的数字。说明所有数字都是正整数。解集不能包含重复的组合。实例1输入: k = 3, n = 7输出: [[1,2,4]]实例2输入: k = 3, n = 9输出: [[1,2,6], [1,3,5], [2...
2019-11-19 00:17:28 216
原创 mac & ubuntu下安装npm install sqlite3的问题
解决mac & ubuntu下安装npm install sqlite3的问题之前想安装sqlite3这个模块来操作数据库的时候,无论怎么都安装失败,各种预编译问题。一开始以为是python版本问题,毕竟mac上用的是anaconda的python3.6,更改了以后不行,ubuntu下使用的是python2.7也不行,翻墙了安装也不行。 最后发现是node的版本问题,google到的...
2018-05-21 00:50:25 2297
原创 windows下python3.6 TA-Lib的安装
windows下python3.6 TA-Lib的安装简介TA-Lib是一个关于金融的库,支持python,然后之前一直支持的是python2.7,新的版本支持了python3.6,介绍如下:TA-Lib,还有github地址安装方法之前一直是pip install TA-Lib,但会遇到库的依赖问题,最好的办法是直接下载包本地安装,但是依然存在依赖问题。而且github上的安装包
2018-02-05 15:32:29 5797
原创 The k-spanning tree problem is the following
8.12 The k-spanning tree problem is the following.DescriptionInput: An undirected graph G = (V,E) Output: A spanning tree of G in which each node has degree ≤ k, if such a tree exists. Show that for
2018-01-01 00:23:45 397
原创 Leetcode 712 Minimum ASCII Delete Sum for Two Strings
Leetcode 712 Minimum ASCII Delete Sum for Two StringsDescriptionGiven two strings s1, s2, find the lowest ASCII sum of deleted characters to make two strings equal.Example 1:Input: s1 = "sea", s2 = "
2017-12-08 21:20:39 271
原创 Leetcode 300 Longest Increasing Subsequence
Leetcode 300 Longest Increasing SubsequenceDescriptionGiven an unsorted array of integers, find the length of longest increasing subsequence. For example,Given [10, 9, 2, 5, 3, 7, 101, 18],The longes
2017-12-08 20:58:08 222
原创 Leetcode 392 Is Subsequence
Leetcode 392 Is SubsequenceDescriptioniven a string s and a string t, check if s is subsequence of t. You may assume that there is only lower case English letters in both s and t. t is potentially a v
2017-12-02 20:12:35 228
原创 Leetcode 413 & 446
Leetcode 413 & 446Leetcode 413 Arithmetic SlicesDescriptionA sequence of number is called arithmetic if it consists of at least three elements and if the difference between any two consecutive elements
2017-11-27 09:47:15 463
原创 Leetcode 486
Leetcode 486DescriptionGiven an array of scores that are non-negative integers. Player 1 picks one of the numbers from either end of the array followed by the player 2 and then player 1 and so on. Each
2017-11-27 09:14:59 624
原创 Leetcode 322 & 518
Leetcode 322 & 518Leetcode 322 Coin ChangeDescriptionYou are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you n
2017-11-19 23:13:04 355
原创 Leetcode 474 Ones and Zeroes
Leetcode 474 Ones and ZeroesDescriptionIn the computer world, use restricted resource you have to generate maximum benefit is what we always want to pursue. For now, suppose you are a dominator of m
2017-11-19 22:51:48 229
原创 Leetcode 322 & 518
Leetcode 322 & 518322 Leetcode Coin ChangeDescriptionYou are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you n
2017-10-29 15:46:13 329
原创 Leetcode 658 Find K Closest Elements
Leetcode 658 Find K Closest ElementsDescriptionGiven a sorted array, two integers k and x, find the k closest elements to x in the array. The result should also be sorted in ascending order. If there i
2017-09-25 17:08:15 438
原创 Leetcode 374 & 375
Leetcode 374 & 375374 Guess Number Higher or LowerDescriptionWe 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 yo
2017-09-25 17:07:47 418
原创 Leetcode 221 & 85
Leetcode 221 & 85Leetcode 221 Maximal SquareDescriptionGiven a 2D binary matrix filled with 0’s and 1’s, find the largest square containing only 1’s and return its area.For example, given the following
2017-09-25 17:05:36 371
原创 LeetCode 84
Leetcode 84 Largest Rectangle in HistogramDescriptionGiven n non-negative integers representing the histogram’s bar height where the width of each bar is 1, find the area of largest rectangle in the hi
2017-09-25 00:34:44 394
原创 Leetcode 169 & 229
Leetcode 169 & 229169 Majority ElementDescriptionGiven an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times.You may assume that the ar
2017-09-18 19:57:04 1265
原创 Leetcode 547
Leetcode547 FriendCirclesdescriptionThere are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature. For example, if A is a direct friend of B, a
2017-09-18 08:47:21 599
原创 Leetcode 105&106
Leetcode 105 & 106这两道题类似,都是根据树的遍历来重建一棵树。 先复习下先序中序后序:先序根左右,中序左根右,后序左右根,区别是根的出现的顺序。一开始想着用传vector的方法,但是后来发现内存爆了,用索引的方法更好说下105即根据先序中序遍历来重建一棵树的做法:因为先序的第一个元素是根,然后在中序遍历中找到这个根。然后在中序的遍历元素中,根左边的那些元素是根的左子树,右边是右子树
2017-09-10 20:45:49 371
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人