inquiry is depicted by a couple of integers li, ri (1≤li

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Correct answer will be upvoted else Multiple Downvoted. Computer science.

inquiry is depicted by a couple of integers li, ri (1≤li<ri≤n). 

 

For each question, he needs to decide if there exists a decent aftereffect in s that is equivalent to the substring s[li… ri]. 

 

A substring s[i… j] of a string s is the string shaped by characters sisi+1… sj. 

 

String an is supposed to be an aftereffect of string b if a can be gotten from b by erasing a few characters without changing the request for the excess characters. 

 

An aftereffect is supposed to be acceptable in case it isn't coterminous and has length ≥2. For instance, in the event that s is "1100110", the aftereffects s1s2s4 ("1100110") and s1s5s7 ("1100110") are acceptable, while s1s2s3 ("1100110") isn't acceptable. 

 

Would you be able to help Hr0d1y answer each question? 

 

Input 

 

The primary line of the input contains a solitary integer t (1≤t≤100) — the number of experiments. The portrayal of each experiment is as per the following. 

 

The principal line contains two integers n (2≤n≤100) and q (1≤q≤100) — the length of the string and the number of questions. 

 

The subsequent line contains the string s. 

 

The I-th of the following q lines contains two integers li and ri (1≤li<ri≤n). 

 

Output 

 

For each experiment, output q lines. The I-th line of the output of each experiment ought to contain "YES" if there exists a decent aftereffect equivalent to the substring s[li...ri], and "NO" in any case. 

 

You might print each letter regardless (upper or lower).

 

 

Expert Solution
steps

Step by step

Solved in 4 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY