<p>
Given two non-empty arrays of integers, write a function that determines
whether the second array is a subsequence of the first one.
</p>
<p>
A subsequence of an array is a set of numbers that aren't necessarily adjacent
in the array but that are in the same order as they appear in the array. For
instance, the numbers <span>[1, 3, 4]</span> form a subsequence of the array
<span>[1, 2, 3, 4]</span>, and so do the numbers <span>[2, 4]</span>. Note
that a single number in an array and the array itself are both valid
subsequences of the array.
</p>
<h3>Sample Input</h3>
<pre><span>array</span> = [5, 1, 22, 25, 6, -1, 8, 10]
<span>sequence</span> = [1, 6, -1, 10]
</pre>
<h3>Sample Output</h3>
<pre>true
</pre>
TypeScript
export function isPalindrome(string) {
// Write your code here.
}
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.