leetcode 438. Find All Anagrams in a String
Description
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 larger than 20,100.
The order of output does not matter.
Example 1:
Input:
s: "cbaebabacd" p: "abc"
Output:
[0, 6]
Explanation:
The subst ...
Posted by Digital Wallfare on Thu, 14 Feb 2019 22:21:18 -0800
T4870 Flood (sliker.cpp/c/pas) 1000MS 64MB
Title Description
The heavy rain should have lasted for several days, but it still didn't stop. Tuhao CCY has just returned from earning 1e yuan from other places, and knows that in the near future, except for his villa, other places will be flooded.
CCY's city can be represented by an N*M (N, M<=50) map with five symbols: "* X ...
Posted by Who27 on Thu, 14 Feb 2019 05:57:19 -0800
The difference between stl::map and boost::unorder_map
The map in stl is implemented based on the red-black tree, and when insert elements, the operator < is used to compare the elements and find the location where the elements can be inserted, so the final traversal results are orderly.
Unorder_map in boost is based on hash value to compare elements. Some elements may have the same hash value b ...
Posted by Jordi_E on Tue, 12 Feb 2019 14:12:17 -0800
Leetcode: 30. Substring with Concatenation of All Words
Description
You are given a string, s, and a list of words, words, that are all of the same length. Find all starting indices of substring(s) in s that is a concatenation of each word in words exactly once and without any intervening characters.
Example
For example, given:
s: "barfoothefoobarman"
words: ["foo", "bar"]
You should return the ind ...
Posted by lunas on Tue, 12 Feb 2019 13:39:18 -0800
C++ Replaces Deleter of unique_ptr with lambda
C++ Replaces Deleter of unique_ptr with lambda
Code
#include <iostream>
#include <cstdlib>
#include <memory>
#include <string>
#include <functional>
using namespace std;
class go
{
public:
go() {}
~go()
{
cout << "go die.\n";
}
};
auto d = [] ( go * gp )
{
delete gp;
cout & ...
Posted by phithe on Sun, 10 Feb 2019 11:57:17 -0800
N Queen Again LightOJ - 1061
N Queen Again LightOJ - 1061
Firstly, all the eight queens'solutions (only 92) are given by pretreatment (or tabulation). Then enumerate the target state, and use a shape pressure dp for each target state to find the minimum cost of reaching that state. The minimum cost of reaching any target state is the answer.
Obviously, if we know the pos ...
Posted by mcog_esteban on Fri, 08 Feb 2019 22:12:17 -0800
Distance in Tree CodeForces - 161D
Distance in Tree CodeForces - 161D
For a tree with n nodes, the distance between any two points is 1. Now it is a little u, v, and the shortest distance between u and V is k. The number of such pairs of points ((u,v)/(v,u) is calculated as a pair.
Method:
ans[i][k] denotes the number of sub-nodes whose distance from I node is k
ans[i][k]=su ...
Posted by mattyj10 on Fri, 08 Feb 2019 21:12:17 -0800
Spring framework delete data operations for jdbcTemplate operation crud in dao layer
Using jdbcTemplate
The principle is to load the driver Class.forName("com.mysql.jdbc.Driver").
Connect to the database Connection conn = DriverManager. getConnection ("jdbc: mysql://localhost: 3306/sw_database? User = root & password = root");
Complete DriverManagerDataSource dataSource=new DriverManagerDataSource() with ...
Posted by JMair on Thu, 07 Feb 2019 01:45:16 -0800
uva11768 Lattice Point or Not
- Restore content to start
Comparing the classical extended Euclidean problem of finding integer solutions.
For two points (x1,y1)(x2,y2), if the point is an integer point, then the number of integers in the interval can be obtained by extending Euclidean equation (y2-y1) x+ (x1-x2) y = x1 y2-x2 y1.
Because the point of this problem is exact to ...
Posted by elabuwa on Mon, 04 Feb 2019 01:27:16 -0800
leetcode 680. Valid Palindrome II Problem Solution [C++/Java/Python]
680. Verification of palindrome strings II 680. Valid Palindrome II
Title:
Given a non-empty string s, delete at most one character. Determine whether it can be a palindrome string.
Example 1:
Input: "aba"
Output: True
Example 2:
Input: "abca"
Output: True
Interpretation: You can ...
Posted by objNoob on Sun, 03 Feb 2019 21:30:16 -0800