Ninja and Substrings Problem Statement

Ninja has to determine all the distinct substrings of size two that can be formed from a given string 'STR' comprising only lowercase alphabetic characters. These substrings must appear as contiguous sequences in 'STR'.

Example:

Input:
"abcd"
Output:
["ab", "bc", "cd"]

Input:

The first line contains a single integer 'T' representing the number of test cases. The next 'T' lines each contain a string 'STR'.

Output:

For each test case, output all unique contiguous substrings of size two from 'STR'. Each test case result should be presented on a new line.

Constraints:

  • 1 <= T <= 5*103
  • 2 <= |STR| <= 103
  • Time limit: 1 sec
Note:
You are not required to print anything; it has been handled for you internally.
AnswerBot
2mo

Find all unique contiguous substrings of size two from a given string.

  • Iterate through the string and extract substrings of size two

  • Use a set to store unique substrings

  • Return the set as an array of str...read more

Chowdam Mounika
3y

For each case case,return all different substring of size two chat appear in S, TR,contiguous substring

Chowdam Mounika
3y

For each case case,return all different substring of size two chat appear in S, TR,contiguous substring

Add answer anonymously...

Wipro Data Analyst interview questions & answers

A Data Analyst was asked 1mo agoQ. What are the three types of golden rules of accounting?
A Data Analyst was asked 1mo agoQ. How would you detect spam messages in email or SMS?
A Data Analyst was asked 1mo agoQ. What programming languages are you proficient in?

Popular interview questions of Data Analyst

A Data Analyst was asked 1mo agoQ1. What are the three types of golden rules of accounting?
A Data Analyst was asked 1mo agoQ2. How would you detect spam messages in email or SMS?
A Data Analyst was asked 1mo agoQ3. What programming languages are you proficient in?

Top HR questions asked in Wipro Data Analyst

A Data Analyst was asked 4mo agoQ1. Can you provide an overview of your background, including your past experiences ...read more
A Data Analyst was asked 6mo agoQ2. What projects did you work on during your college years?
A Data Analyst was asked 23 Oct 2021Q3. What type of work experience are you looking for?
Wipro Data Analyst Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter