Output: true
### []( https://codechina.csdn.net/m0_60958482/java-p7 )**Train of thought** **(dynamic programming)** O ( n m ) O(nm) O(nm) Status indication:`f[i][j]`express p from j From beginning to end, can you match s from i Start to end State transition: 1. If`p[j+1]`Not a wildcard`'*'`,be`f[i][j]`True if and only if`s[i]`Can and`p[j]`Match, and`f[i+1][j+1]`Is true; 2. If`p[j+1]`Is a wildcard`'*'`,Then as long as one of the following conditions is satisfied,`f[i][j]`Is true; * `f[i][j+2]`Is true; This here represents 0 p\[j\] * `s[i]`Can and`p[j]`Match, and`f[i+1][j]`Is true; The state transition in case 1 is well understood. How to understand the state transition in case 2? The most intuitive way to transfer is to enumerate wildcards`'*'`How many can be matched`p[j]`,As long as there is a match, then`f[i][j]`Is true; In doing so, we find that,`f[i][j]`Except enumerating 0`p[j]`Other enumeration operations are included in`f[i+1][j]`Yes, so we just need to judge `f[i+1][j]`Whether it is true, and`s[i]`Can I talk to you`p[j]`Just match. Time complexity analysis: n n n express s s s The length of the, m m m express p Length of, total n m nm nm State transition complexity O ( 1 ) O(1) O(1),So the total time complexity is O ( n m ) O(nm) O(nm). ### []( https://codechina.csdn.net/m0_60958482/java-p7 )**Code**
class Solution {
public:
vector<vector<int>>f; int n, m; bool isMatch(string s, string p) { n = s.size(); m = p.size(); f = vector<vector<int>>(n + 1, vector<int>(m + 1, -1)); return dp(0, 0, s, p); } bool dp(int x, int y, string &s, string &p) { if (f[x][y] != -1) return f[x][y]; if (y == m) return f[x][y] = x == n; bool first_match = x < n && (s[x] == p[y] || p[y] == '.'); bool ans; if (y + 1 < m && p[y + 1] == '*') { ans = dp(x, y + 2, s, p) || first_match && dp(x + 1, y, s, p); } else ans = first_match && dp(x + 1, y + 1, s, p);
last
Xiaobian shares some of my usual learning materials here. Due to space constraints, the detailed information of pdf documents is too comprehensive, and there are too many details, so I only give a rough introduction to the screenshots of some knowledge points, and there are more detailed contents in each small node! If you need a program, you can follow + like it, Click here for free
Programmer code interview guide IT famous enterprise algorithm and data structure problem optimal solution
This is the "programmer interview book! The book summarizes the optimal solutions of various questions in the code interview of IT famous enterprises, and provides the implementation of relevant codes. In view of the lack of authoritative topic summary in the current programmer interview, this book selects nearly 200 classic code interview questions that have actually appeared, so as to help the "big programmers" make sure of their interview preparation. "After brushing this book, you are the" question king "!
TCP-IP protocol group (version 4)
This book is the latest version of the classic book on TCP/IP protocol family. This book has been popular with readers since its first edition was published.
The latest edition of this book "carries out" to protect the elements, taking into account the latest development of computer network technology in the physical environment. The book has seven parts, 30 drafts and seven appendices: the first part introduces some basic concepts and basic underlying technologies; the second part introduces network layer protocols; the third part introduces transport layer protocols; The fourth part introduces the application layer protocol: the fifth part introduces the next generation protocol, namely IPv6 protocol; the sixth part introduces the network security issues; the seventh part gives seven appendices.
Java development manual (Songshan version)
Needless to say, I read Ali's development manual every time it is updated. This is the latest * * (Songshan version) in early August**
MySQL 8 from entry to mastery
The main contents of this book include MySQL installation and configuration, database creation, data table creation, data types and operators, MySQL functions, querying data, data table operations (inserting, updating and deleting data), indexes, stored procedures and functions, views, triggers, user management, data backup and restore, MySQL logs, performance optimization, MySQL repl application MySQL Workbench, MySQL Utilities, MySQL Proxy, PHP operation MySQL database and PDO database abstract class library, etc. Finally, through the database design of three comprehensive cases, this paper describes the application of MySQL in practical work.
Spring 5 Advanced Programming (version 5)
This book covers all the contents of Spring 5. If you want to make full use of the powerful functions of this leading enterprise Java application development framework, this book is the most comprehensive Spring reference and practical guide.
The fifth edition of this book covers the core Spring and its integration with other leading Java technologies such as Hibemate JPA 2.Tls, Thymeleaf and websocket. This book focuses on how to use java to configure classes, lambda expressions, Spring Boot and reactive programming. At the same time, some insights and practical experience will be shared with enterprise application developers, including remoting, transaction, Web and presentation layers, and so on.
Java core knowledge points + 1000 Internet Java Engineer Interview Questions
The way of enterprise IT architecture transformation Alibaba's China Taiwan strategic thought and Architecture Practice
This book describes the technological development history of Alibaba, as well as the practice and development history of the Internet technology architecture.
...(img-e9qoQ7R4-1629247724796)]
[external chain picture transferring... (IMG fbtblb5l-1629247724797)]
The way of enterprise IT architecture transformation Alibaba's China Taiwan strategic thought and Architecture Practice
This book describes the technological development history of Alibaba, as well as the practice and development history of the Internet technology architecture.