<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>https://wiki.riguz.com/index.php?action=history&amp;feed=atom&amp;title=392.Is_Subsequence</id>
	<title>392.Is Subsequence - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.riguz.com/index.php?action=history&amp;feed=atom&amp;title=392.Is_Subsequence"/>
	<link rel="alternate" type="text/html" href="https://wiki.riguz.com/index.php?title=392.Is_Subsequence&amp;action=history"/>
	<updated>2026-06-02T18:41:16Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://wiki.riguz.com/index.php?title=392.Is_Subsequence&amp;diff=4140&amp;oldid=prev</id>
		<title>Riguz：​创建页面，内容为“=Description= {{LeetCode |id=is-subsequence |no=392 |difficulty=Easy |category=String |collection=Top 150 |title=Is Subsequence |summary=Given two strings s and t, return true if s is a subsequence of t, or false otherwise.}}  A subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., &quot;ace&quot; is a subsequence of &quot;ab…”</title>
		<link rel="alternate" type="text/html" href="https://wiki.riguz.com/index.php?title=392.Is_Subsequence&amp;diff=4140&amp;oldid=prev"/>
		<updated>2024-02-19T15:56:49Z</updated>

		<summary type="html">&lt;p&gt;创建页面，内容为“=Description= {{LeetCode |id=is-subsequence |no=392 |difficulty=Easy |category=String |collection=Top 150 |title=Is Subsequence |summary=Given two strings s and t, return true if s is a subsequence of t, or false otherwise.}}  A subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., &amp;quot;ace&amp;quot; is a subsequence of &amp;quot;ab…”&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=Description=&lt;br /&gt;
{{LeetCode&lt;br /&gt;
|id=is-subsequence&lt;br /&gt;
|no=392&lt;br /&gt;
|difficulty=Easy&lt;br /&gt;
|category=String&lt;br /&gt;
|collection=Top 150&lt;br /&gt;
|title=Is Subsequence&lt;br /&gt;
|summary=Given two strings s and t, return true if s is a subsequence of t, or false otherwise.}}&lt;br /&gt;
&lt;br /&gt;
A subsequence of a string is a new string that is formed from the original string by deleting some (can be none) of the characters without disturbing the relative positions of the remaining characters. (i.e., &amp;quot;ace&amp;quot; is a subsequence of &amp;quot;abcde&amp;quot; while &amp;quot;aec&amp;quot; is not).&lt;br /&gt;
&lt;br /&gt;
Example 1:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Input: s = &amp;quot;abc&amp;quot;, t = &amp;quot;ahbgdc&amp;quot;&lt;br /&gt;
Output: true&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Example 2:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;bash&amp;quot;&amp;gt;&lt;br /&gt;
Input: s = &amp;quot;axc&amp;quot;, t = &amp;quot;ahbgdc&amp;quot;&lt;br /&gt;
Output: false&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== pointer==&lt;br /&gt;
{{Submission|runtime=1ms|memory=41.17MB|rp=91.15|mp=87.38}}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
class Solution {&lt;br /&gt;
    public boolean isSubsequence(String s, String t) {&lt;br /&gt;
        if(t.length() &amp;lt; s.length()) return false;&lt;br /&gt;
        if(s.length() == 0) return true;&lt;br /&gt;
        int p = 0;&lt;br /&gt;
        for(int i = 0; i &amp;lt; t.length(); i++) {&lt;br /&gt;
            if(t.charAt(i) == s.charAt(p)) {&lt;br /&gt;
                if(p == s.length() -1) return true;&lt;br /&gt;
                p++;&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
        return false;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:Algorithm]]&lt;br /&gt;
[[Category:String]]&lt;br /&gt;
[[Category:LeetCode]]&lt;/div&gt;</summary>
		<author><name>Riguz</name></author>
	</entry>
</feed>