Repeating Sub-Sequence

Given a string, find if there is any sub-sequence that repeats itself.
A sub-sequence of a string is defined as a sequence of characters generated by deleting some characters in the string without changing the order of the remaining characters.

Input:
string

Output:

0/1
0 -> No
1 -> Yes 

Example:

abab ------> yes, ab is repeated. So, return 1. 
abba ------> No, a and b follow different order. So, return 0. 

NOTE : sub-sequence length should be greater than or equal to 2

NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Repeating Sub-Sequence on Interview Code Editor
Sign Up
to access hints and editorial solutions for Repeating Sub-Sequence
Asked In:
  • Google
Click here to start solving coding interview questions