自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 Java设计模式 --- 七大常用设计模式

原文链接:https://blog.csdn.net/weixin_40834464/article/details/82958187设计模式分为三种类型,共23种:创建型模式:单例模式、抽象工厂模式、建造者模式、工厂模式、原型模式结构型模式:适配器模式、桥接模式、装饰模式、组合模式、外观模式、享元模式、代理模式行为型模式:模板方法模式、命令模式、迭代器模式、观察者模式、中介者...

2020-02-05 23:36:17 238

转载 Java并发-懒汉式单例设计模式加volatile的原因

懒汉式单例的double check、例一:class SingletonClass{ private static SingletonClass instance = null; private SingletonClass() {} public static SingletonClass getInstance() { if(inst...

2020-02-05 23:33:03 519 2

原创 最大映射

有 n 个字符串,每个字符串都是由 A-J 的大写字符构成。现在你将每个字符映射为一个 0-9 的数字,不同字符映射为不同的数字。这样每个字符串就可以看做一个整数,唯一的要求是这些整数必须是正整数且它们的字符串不能有前导零。现在问你怎样映射字符才能使得这些字符串表示的整数之和最大?输入描述:每组测试用例仅包含一组数据,每组数据第一行为一个正整数 n , 接下来有 n 行,每行一个长度不超过...

2018-10-13 20:23:22 833

原创 leetcode——Number of Boomerangs

原题:Given n points in the plane that are all pairwise distinct, a "boomerang" is a tuple of points (i, j, k) such that the distance between i and j equals the distance between i and k (the

2017-08-07 16:04:48 213

原创 算法概论习题8.8——证明精确的4SAT是NP-完全问题

题目:在精确的4SAT(EXACT 4SAT)问题中,输入为一组自居,每个字句都是恰好4个文字的析取,且每个变量最多在每个字句中出现一次。目标是求它的满足赋值——如果该赋值存在。证明精确的4SAT是NP完全问题。证明如下:由于3SAT问题是NP-完全问题,若能将3SAT问题归约到精确的4SAT问题,则可证明精确的4SAT问题也是NP-完全问题。以下是将3SAT问题归约到精确的4SA

2017-01-11 23:53:57 753

原创 leetcode——Find All Anagrams in a String

Given a string s and a non-empty string p, find all the start indices of p's anagrams in s.Strings consists of lowercase English letters only and the length of both strings s and p will not be lar

2016-12-08 21:23:11 273

原创 leetcode——TwoSum、3Sum

TwoSumGiven an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution.Example:

2016-11-18 23:00:51 340

原创 leetcode——Largest Number

原题:Given a list of non negative integers, arrange them such that they form the largest number.For example, given [3, 30, 34, 5, 9], the largest formed number is 9534330.Note: The result

2016-11-18 22:39:44 247

原创 leetcode——Wiggle Subsequence

A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either pos

2016-11-04 00:04:30 195

原创 leetcode——Non-overlapping Intervals

Given a collection of intervals, find the minimum number of intervals you need to remove to make the rest of the intervals non-overlapping.Note:You may assume the interval's end point is alw

2016-11-03 23:55:04 419

原创 leetcode——Remove K Digits

Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible.Note:The length of num is less than 10002 and will b

2016-11-03 23:30:48 317

原创 leetcode——Queue Reconstruction by Height

Suppose you have a random list of people standing in a queue. Each person is described by a pair of integers (h, k), where h is the height of the person and k is the number of people in front of t

2016-11-03 00:13:28 486

原创 leetcode——Best Time to Buy and Sell StockⅠ& Ⅱ& Ⅲ & Ⅳ

Best Time to Buy and Sell StockSay 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

2016-11-02 23:09:06 253

原创 leetcode——Unique Paths & Unique PathsⅡ

Unique PathsA robot is located at the top-left corner of a m x n grid (marked 'Start' in the diagram below).The robot can only move either down or right at any point in time. The robot is

2016-11-01 20:42:40 204

原创 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 day i.If you were only permitted to complete at most one transaction (ie, buy one and sell one share of t

2016-10-18 20:58:37 283

原创 leetcode——Decode String

原题目:Given an encoded string, return it's decoded string.The encoding rule is: k[encoded_string], where the encoded_string inside the square brackets is being repeated exactly k times. Note

2016-09-25 16:12:45 328 1

原创 leetcode——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 uniq

2016-09-13 00:11:33 220

原创 leetcode——Different Ways to Add Parentheses

原题目:Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. The valid operators are +, - and *.Examp

2016-09-12 00:29:58 253

原创 leetcode——Majority Element

原题目:Given 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 array is non-empty and the majorit

2016-09-11 19:08:10 229

原创 leetcode——Kth Largest Element in an Array

原题目:Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.For example,Given [3,2,1,5,6,4] and k = 2,

2016-09-11 13:26:18 172

原创 leetcode——Maximum Subarray

原题目:Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [-2,1,-3,4,-1,2,1,-5,4],the contiguous subarray [4,

2016-09-11 00:07:06 215

原创 leetcode——Climbing Stairs

原题目:You are climbing a stair case. It takes n steps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?解析:若n=1则只有一种方法,n=2则有

2016-09-10 17:54:29 172

原创 leetcode——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 algor

2016-09-09 00:11:13 218

原创 leetcode——Two Sum II - Input array is sorted

原题目:Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number.The function twoSum should return indices of the

2016-09-07 23:21:17 185

原创 leetcode——Add Two Numbers

原题目:You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it

2016-09-06 00:59:51 227

原创 leetcode——Is Subsequence

原题目:Given 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 very long (length ~= 500,

2016-09-05 17:09:52 226

原创 leetcode——Longest Substring Without Repeating Characters

原题:Given a string, find the length of the longest substring without repeating characters.Examples:Given "abcabcbb", the answer is "abc", which the length is 3.Given "bbbbb", the answ

2016-09-05 16:28:36 180

空空如也

空空如也

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

TA关注的人

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