自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Trie图(AC自动机)---两种风格

方式一:structTrieNode*next,便于理解简单trie图,还是推荐用这个。容易MLE方式二:trie[N][26];suffix[N];val[N],AC概率高比赛中,还是用这个吧。...

2020-01-31 17:33:18 383 1

原创 KMP----几道题目

1,kmp的next数组,还是需要比p数组长+1之前一直使用等长的next数组,后来发现有诸多不便。 2,训练题:hdu: 1358 , 1686, 1711 poj: 2406...

2020-01-29 16:25:10 153

原创 LeetCode136 Single Number

详细见:leetcode.com/problems/single-numberJava Solution: githubpackage leetcode;/* * Given an array of integers, every element appears twice except for one. * Find that single one. Note

2017-05-18 22:23:48 398

原创 LeetCode135 Candy

详细见:leetcode.com/problems/candyJava Solution: githubpackage leetcode;/* * There are N children standing in a line. Each child is assigned a rating value. You are giving candies to the

2017-05-18 22:22:47 380

原创 LeetCode134 Gas Station

详细见:leetcode.com/problems/gas-stationJava Solution: githubpackage leetcode;/* * There are N gas stations along a circular route, * where the amount of gas at station i is gas[i]. Yo

2017-05-17 19:45:48 435

原创 LeetCode133 Clone Graph

详细见:leetcode.com/problems/clone-graphJava Solution: githubpackage leetcode;import java.util.HashMap;import java.util.LinkedList;import java.util.Queue;/* * Clone an undirected graph.

2017-05-15 22:28:07 330

原创 LeetCode132 Palindrome Partitioning II

详细见:leetcode.com/problems/palindrome-partitioning-iiJava Solution: githubpackage leetcode;/** Given a string s, partition s such that every substring of the partition is a palindr

2017-05-15 22:27:58 257

原创 LeetCode131 Palindrome Partitioning

详细见:leetcode.com/problems/palindrome-partitioningJava Solution: githubpackage leetcode;import java.util.ArrayList;import java.util.LinkedList;import java.util.List;/* * Given a strin

2017-05-15 22:27:46 321

原创 LeetCode130 Surrounded Regions

详细见:leetcode.com/problems/word-ladderJava Solution: githubpackage leetcode;/* Given a 2D board containing 'X' and 'O' (the letter O), capture all regions surrounded by 'X'. A reg

2017-05-13 21:50:53 431

原创 LeetCode129 Sum Root to Leaf Numbers

详细见:leetcode.com/problems/sum-root-to-leaf-numbersJava Solution: githubpackage leetcode;import java.util.LinkedList;import java.util.Queue;import tools.TreeNode辅助;/* * Given a binar

2017-05-13 21:50:32 303

原创 LeetCode128 Longest Consecutive Sequence

详细见:leetcode.com/problems/longest-consecutive-sequenceJava Solution: githubpackage leetcode;import java.util.HashMap;import java.util.HashSet;/* * Given an unsorted array of integers,

2017-05-13 21:50:03 248

原创 LeetCode127 Word Ladder

详细见:leetcode.com/problems/word-ladderJava Solution: githubpackage leetcode;import java.util.ArrayList;import java.util.HashSet;import java.util.LinkedList;import java.util.Queue;/* *

2017-05-12 22:25:55 340

原创 LeetCode126 Word Ladder II

详细见:leetcode.com/problems/word-ladder-iiJava Solution: githubpackage leetcode;import java.util.ArrayList;import java.util.Arrays;import java.util.HashMap;import java.util.HashSet;/*

2017-05-11 22:26:08 363

原创 LeetCode125 Valid Palindrome

详细见:leetcode.com/problems/valid-palindromeJava Solution: githubpackage leetcode;/* Given a string, determine if it is a palindrome, considering only alphanumeric characters and ig

2017-05-11 22:25:45 306

原创 LeetCode124 Binary Tree Maximum Path Sum

详细见:leetcode.com/problems/binary-tree-maximum-path-sumJava Solution: githubpackage leetcode;import tools.TreeNode辅助.TreeNode;/* Given a binary tree, find the maximum path sum. For

2017-05-11 22:25:26 280

原创 LeetCode123 Best Time to Buy and Sell Stock III

详细见:leetcode.com/problems/best-time-to-buy-and-sell-stock-iiiJava Solution: githubpackage leetcode;import java.util.ArrayList;/* * Say you have an array for which the ith element is th

2017-05-06 22:17:47 368

原创 LeetCode122 Best Time to Buy and Sell Stock II

详细见:leetcode.com/problems/best-time-to-buy-and-sell-stock-iiJava Solution: githubpackage leetcode;/* * Say you have an array for which the ith element is the price of * a given stock

2017-05-06 22:17:33 372

原创 LeetCode121 Best Time to Buy and Sell Stock

详细见:leetcode.com/problems/best-time-to-buy-and-sell-stockJava Solution: githubpackage leetcode;/* * Say you have an array for which the ith element is the price of * a given stock on

2017-05-06 22:17:12 424

原创 LeetCode120 Triangle

详细见:leetcode.com/problems/triangleJava Solution: githubpackage leetcode;/* * Given a triangle, find the minimum path sum from top to bottom. * Each step you may move to adjacent numbe

2017-05-04 22:24:13 344

原创 LeetCode119 Pascal's Triangle II

详细见:leetcode.com/problems/pascals-triangle-iiJava Solution: githubpackage leetcode;import java.util.ArrayList;import java.util.List;/* * Given an index k, return the kth row of the Pa

2017-05-04 22:23:57 359

原创 LeetCode118 Pascal's Triangle

详细见:leetcode.com/problems/pascals-triangleJava Solution: githubpackage leetcode;import java.util.ArrayList;import java.util.Iterator;/* * Given numRows, generate the first numRows of

2017-05-04 22:23:42 238

原创 LeetCode117 Populating Next Right Pointers in Each Node II

详细见:leetcode.com/problems/populating-next-right-pointers-in-each-node-iiJava Solution: githubpackage leetcode;/* * Follow up for problem "Populating Next Right Pointers in Each Node".

2017-05-01 20:45:12 384

原创 LeetCode116 Populating Next Right Pointers in Each Node

详细见:leetcode.com/problems/populating-next-right-pointers-in-each-nodeJava Solution: githubpackage leetcode;import tools.TreeLinkNode辅助.TreeLinkNode;/* * Given a binary tree stru

2017-05-01 20:44:56 217

原创 LeetCode115 Distinct Subsequences

详细见:leetcode.com/problems/distinct-subsequencesJava Solution: githubpackage leetcode;/* * Given a string S and a string T, count the number of distinct subsequences of * T in S. A s

2017-05-01 20:44:35 343

原创 LeetCode114 Flatten Binary Tree to Linked List

详细见:leetcode.com/problems/flatten-binary-tree-to-linked-listJava Solution: githubpackage leetcode;/* * Given a binary tree, flatten it to a linked list in-place. For example, Given

2017-05-01 15:12:14 224

原创 LeetCode113 Path Sum II

详细见:leetcode.com/problems/path-sum-iiJava Solution: githubpackage leetcode;import java.util.ArrayList;import java.util.LinkedList;import java.util.List;import tools.TreeNode辅助.TreeNode

2017-05-01 15:11:56 259

原创 LeetCode112 Path Sum

详细见:leetcode.com/problems/path-sumJava Solution: githubpackage leetcode;import java.util.LinkedList;import java.util.Queue;import tools.TreeNode辅助.TreeNode;/* * Given a binary tree

2017-05-01 15:10:48 295

原创 LeetCode111 Minimum Depth of Binary Tree

详细见:leetcode.com/problems/minimum-depth-of-binary-treeJava Solution: githubpackage leetcode;import java.util.LinkedList;import java.util.Queue;/* * Given a binary tree, find its minim

2017-04-29 18:56:02 252

原创 LeetCode110 Balanced Binary Tree

详细见:leetcode.com/problems/balanced-binary-treeJava Solution: githubpackage leetcode;import tools.TreeNode辅助.TreeNode;/* * Given a binary tree, determine if it is height-balanced. For

2017-04-29 18:55:42 333

原创 LeetCode109 Convert Sorted List to Binary Search Tree

详细见:leetcode.com/problems/convert-sorted-list-to-binary-search-treeJava Solution: githubpackage leetcode;import java.util.ArrayList;import java.util.HashMap;/* * Given a singly linked

2017-04-29 18:55:21 222

原创 LeetCode108 Convert Sorted Array to Binary Search Tree

详细见:leetcode.com/problems/convert-sorted-array-to-binary-search-treeJava Solution: githubpackage leetcode;import tools.TreeNode辅助.TreeNode;/* * Given an array where elements are sorted

2017-04-28 22:04:50 272

原创 LeetCode107 Binary Tree Level Order Traversal II

详细见:leetcode.com/problems/binary-tree-level-order-traversal-iiJava Solution: githubpackage leetcode;import java.util.Iterator;/* * Given a binary tree, return the bottom-up level order

2017-04-28 22:03:56 245

原创 LeetCode106 Construct Binary Tree from Inorder and Postorder Traversal

详细见:leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversalJava Solution: githubpackage leetcode;import tools.TreeNode辅助.TreeNode;public class P106_ConstructBina

2017-04-28 22:03:24 224

原创 LeetCode105 Construct Binary Tree from Preorder and Inorder Traversal

详细见:leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversalJava Solution: githubpackage leetcode;import tools.TreeNode辅助.TreeNode;public class P105_ConstructBinar

2017-04-27 22:00:23 190

原创 LeetCode104 Maximum Depth of Binary Tree

详细见:leetcode.com/problems/maximum-depth-of-binary-treeJava Solution: githubpackage leetcode;/* * Given a binary tree, find its maximum depth. The maximum depth is the number of nodes a

2017-04-27 22:00:18 378

原创 LeetCode103 Binary Tree Zigzag Level Order Traversal

详细见:leetcode.com/problems/binary-tree-zigzag-level-order-traversalJava Solution: githubpackage leetcode;import java.util.ArrayList;import java.util.LinkedList;import java.util.List;impo

2017-04-27 22:00:13 211

原创 LeetCode102 Binary Tree Level Order Traversal

详细见:leetcode.com/problems/binary-tree-level-order-traversalJava Solution: githubpackage leetcode;/* * Given a binary tree, return the level order traversal of its nodes' values. * (ie

2017-04-26 21:58:17 221

原创 LeetCode101 Symmetric Tree

详细见:leetcode.com/problems/symmetric-treeJava Solution: githubpackage leetcode;/* * Given a binary tree, check whether it is a mirror of itself * (ie, symmetric around its center). F

2017-04-26 21:58:08 225

原创 LeetCode100 Same Tree

详细见:leetcode.com/problems/same-treeJava Solution: githubpackage leetcode;import tools.TreeNode辅助.TreeNode;public class P100_SameTree { public static void main(String[] args) { } /*

2017-04-26 21:58:00 226

原创 LeetCode099 Recover Binary Search Tree

详细见:leetcode.com/problems/recover-binary-search-treeJava Solution: githubpackage leetcode;import java.util.ArrayList;/* * Two elements of a binary search tree (BST) are swapped by mist

2017-04-25 21:35:33 191

空空如也

空空如也

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

TA关注的人

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