自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 68. Text Justification

Problem Description:Given an array of words and a widthmaxWidth, format the text such that each line has exactlymaxWidthcharacters and is fully (left and right) justified.You should pack your words in a greedy approach; that is, pack as many words ...

2020-09-03 19:05:51 177

原创 67. Add Binary

Problem Description:67.Add BinaryEasy1983285Add to ListShareGiven two binary strings, return their sum (also a binary string).The input strings are bothnon-emptyand contains only characters1or0.Example 1:Input: a = "11", b = "1"Outpu...

2020-08-17 14:32:50 190

原创 65. Valid Number

Problem Description:alidate if a given string can be interpreted asa decimal number.Some examples:"0"=>true" 0.1 "=>true"abc"=>false"1 a"=>false"2e10"=>true" -90e3 "=>true" 1e"=>false"e3"=>false" 6e-1"=>...

2020-08-17 12:42:44 148

原创 60. Permutation Sequence

Problem Description:The set[1,2,3,...,n]contains a total ofn! unique permutations.By listing and labeling all of the permutations in order, we get the following sequence forn= 3:"123" "132" "213" "231" "312" "321"Givennandk, return the...

2020-08-03 17:49:54 92

原创 58. Length of Last Word

Problem Description:Given a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word (last word means the last appearing word if we loop from left to right) in the string.If the last word does not ...

2020-08-03 17:22:25 206

原创 52. N-Queens II

Problem Description:Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return the number ofdistinct solutions to then-queens puzzle.Example:Input: 4Output...

2020-07-30 16:11:14 88

原创 51. N-Queens

Problem Description:Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return all distinct solutions to then-queens puzzle.Each solution contains a distinct bo...

2020-07-30 16:03:39 132

原创 50. Pow(x, n)

Problem Description:Implementpow(x,n), which calculatesxraised to the powern(xn).Example 1:Input: 2.00000, 10Output: 1024.00000Example 2:Input: 2.10000, 3Output: 9.26100Example 3:Input: 2.00000, -2Output: 0.25000Explanation: 2...

2020-07-29 15:35:14 98

原创 47. Permutations II

Problem Description:Given a collection of numbers that might contain duplicates, return all possible unique permutations.Example:Input: [1,1,2]Output:[ [1,1,2], [1,2,1], [2,1,1]]Code:class Solution { List<List<Integer&

2020-07-29 14:25:40 97

原创 46. Permutations

Problem Description:Given a collection ofdistinctintegers, return all possible permutations.Example:Input: [1,2,3]Output:[ [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], [3,2,1]]Code:class Solution { List<List<Integer..

2020-07-29 12:21:28 96

原创 44. Wildcard Matching

Problem Description:Given an input string (s) and a pattern (p), implement wildcard pattern matching with support for'?'and'*'.'?' Matches any single character.'*' Matches any sequence of characters (including the empty sequence).The matching ...

2020-07-28 18:16:36 164

原创 SpringBoot JPA MySQL 遇到中文乱码的解决办法

在SpringBoot JPA中使用MySQL时, 数据库的值为中文乱码, 需要如下两个方面的设置,1. 数据库的编码为UTF-8, 或者GB2312 也可以.ALTER SCHEMA `YourDBName` DEFAULT CHARACTER SET utf8 ;2. 更改Springboot的配置文件, 更改MySQL链接如下spring.datasource.url= jdbc:mysql://localhost:3306/YourDBName?characterEnco...

2020-06-02 15:52:46 657

原创 700. Search in a Binary Search Tree

Problem Description:Given the root node of a binary search tree (BST) and a value. You need to find the node in the BST that the node's value equals the given value. Return the subtree rooted with that node. If such node doesn't exist, you should return

2020-06-01 18:11:00 140

原创 整理一些除了Google Adsense以外比较适合英文站的国外广告联盟

最近一直在研究除了google adsense 以外的其他适合英文站的国外广告联盟,以替代被google adsense k站中的广告,不然不错的流量就太可惜了,在网上搜索,整理出如下几个口碑不错的广告联盟。如果你有其他更好的广告联盟,欢迎大家留言补充啊!infolinks- 一个内文广告联盟,效果很好,除adsense外必做的广告,因为它并不影响adsense的广告位,相当于多一份收入。支持paypal付款。adbrite– 跟adsense类似的关键字广告,不过广告形式比google多,如.

2020-05-09 12:06:14 5827 2

原创 237. Delete Node in a Linked List

Problem:Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Given linked list --head =[4,5,1,9], which looks like following:Exampl...

2020-03-26 11:42:07 121

原创 234. Palindrome Linked List

Problem:Given a singly linked list, determine if it is a palindrome.Example 1:Input: 1->2Output: falseExample 2:Input: 1->2->2->1Output: trueFollow up:Could you do it in ...

2020-03-24 12:26:14 86

原创 206. Reverse Linked List

Problem:Reverse a singly linked list.Example:Input: 1->2->3->4->5->NULLOutput: 5->4->3->2->1->NULLFollow up:A linked list can be reversed either iteratively...

2020-03-24 12:20:29 126

原创 203. Remove Linked List Elements

Problem:Remove all elements from a linked list of integers that have valueval.Example:Input: 1->2->6->3->4->5->6, val = 6Output: 1->2->3->4->5Analysis:本题的...

2020-03-24 12:08:04 105

原创 160. Intersection of Two Linked Lists

Problem:Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:begin to intersect at node c1.Example 1:...

2020-03-24 11:51:07 103

原创 148. Sort List

Problem:Sort a linked list inO(nlogn) time using constant space complexity.Example 1:Input: 4->2->1->3Output: 1->2->3->4Example 2:Input: -1->5->3->4->0...

2020-03-23 18:08:21 96

原创 Java的特点

Java是一种“简单”、面向对象、分布式、解释型、健壮、安全、体系结构中立、可移植、高性能和动态的变成语言。简单:Java的设计目的是让专业程序员觉得既易学又好用。假设你有编程经历,你将不觉得Java难掌握,如果你已经理解面向对象编程的基本概念,学习Java更加容易; 面向对象:面向对象是现代编程语言的重要特征之一,面向对象技术极大地提高了人们的软件开发能力; 分布式:分布式包括数据分布和...

2020-03-23 15:24:19 521

转载 Java 概述

一、Java 简介 Java是一种可以撰写跨平台应用程序的面向对象的程序设计语言。Java技术具有卓越的通用性、高效性、平台移植性和安全性,广泛应用于PC,数据中心,游戏控制台、科学超级计算机,移动电话和互联网,同时拥有全球最大的开发者专业社群。 Java是由Sum Microsystems公司推出的Java面向对象程序设计语言(以下简称Java语言)和Java平台的总称。由J...

2020-03-23 12:13:25 363

原创 147. Insertion Sort List

Problem:Sort a linked list using insertion sort.A graphical example of insertion sort. The partial sorted list (black) initially contains only the first element in the list.With each iteration ...

2020-03-20 18:11:53 89

原创 143. Reorder List

Problem:Given a singly linked listL:L0→L1→…→Ln-1→Ln,reorder it to:L0→Ln→L1→Ln-1→L2→Ln-2→…You maynotmodify the values in the list's nodes, only nodes itself may be changed.Example 1:Giv...

2020-03-20 16:29:48 80

原创 142. Linked List Cycle II

Problem:Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.To represent a cycle in the given linked list, we use an integerposwhich represents the po...

2020-03-20 15:34:38 77

原创 141. Linked List Cycle

Problem:Given a linked list, determine if it has a cycle in it.To represent a cycle in the given linked list, we use an integerposwhich represents the position (0-indexed)in the linked list wh...

2020-03-20 15:12:42 106

原创 109. Convert Sorted List to Binary Search Tree

Problem:Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.For this problem, a height-balanced binary tree is defined as a binary tree in...

2020-03-20 14:58:00 113

原创 92. Reverse Linked List II

Problem:Reverse a linked list from positionmton. Do it in one-pass.Note:1 ≤m≤n≤ length of list.Example:Input: 1->2->3->4->5->NULL, m = 2, n = 4Output: 1->4->3-&...

2020-03-19 17:39:29 86

原创 86. Partition List

Problem:Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the original relative order of the nodes i...

2020-03-19 16:27:21 119

原创 83. Remove Duplicates from Sorted List

Problem:Given a sorted linked list, delete all duplicates such that each element appear onlyonce.Example 1:Input: 1->1->2Output: 1->2Example 2:Input: 1->1->2->3->3...

2020-03-19 15:29:13 73

原创 82. Remove Duplicates from Sorted List II

Problem:Given a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the original list.Return the linked list sorted as well.Example 1:Input: ...

2020-03-19 13:43:26 104

原创 61. Rotate List

Problem:Given a linkedlist, rotate the list to the right bykplaces, wherekis non-negative.Example 1:Input: 1->2->3->4->5->NULL, k = 2Output: 4->5->1->2->3->...

2020-03-19 12:24:08 88

原创 274. H-Index

Problem:Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index.According to thedefinition of h-index on Wikip...

2020-03-16 16:53:39 87

原创 205. Isomorphic Strings

Problem:Given two stringssandt, determine if they are isomorphic.Two strings are isomorphic if the characters inscan be replaced to gett.All occurrences of a character must be replaced wi...

2020-03-16 16:33:17 100

原创 242. Valid Anagram

Problem:Given two stringssandt, write a function to determine iftis an anagram ofs.Example 1:Input: s = "anagram", t = "nagaram"Output: trueExample 2:Input: s = "rat", t = "car"...

2020-03-14 16:48:19 75

原创 204. Count Primes

Problem:Count the number of prime numbers less than a non-negative number,n.Example:Input: 10Output: 4Explanation: There are 4 prime numbers less than 10, they are 2, 3, 5, 7.Analysis:...

2020-03-13 16:15:17 101

原创 202. Happy Number

Problem:Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of th...

2020-03-11 15:45:23 130

原创 187. Repeated DNA Sequences

Problem:All DNA is composed of a series of nucleotides abbreviated as A, C, G, and T, for example: "ACGAATTCCG". When studying DNA, it is sometimes useful to identify repeated sequences within the ...

2020-03-11 15:08:20 117

原创 166. Fraction to Recurring Decimal

Problem:Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.If the fractional part is repeating, enclose the repeating part in parent...

2020-03-11 13:03:16 110

原创 149. Max Points on a Line

Problem:Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line.Example 1:Input: [[1,1],[2,2],[3,3]]Output: 3Explanation:^|| o| o| ...

2020-03-10 15:40:28 93

空空如也

空空如也

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

TA关注的人

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