Given an array **A** of **N** integers, Your task is to complete the function **find3Numbers** which finds any 3 elements in it such that A[i] < A[j] < A[k] and i < j < k. You need to return them as a vector, if no such element is present then return the empty vector of size 0.

**Input:**

The first line of input contains an integer T denoting the no of test cases. Then T test cases follow. The first line of each test case contains an integer N denoting the size of the array A in the next line are N space separated values of the array A.

**Output:**

For each test case in a new line output will be 1 if the sub-sequence returned by the function is present in array A else 0.

**Constraints:**

1 <= T <= 100

1 <= N <= 10^{5}

1 <= A[ ] <= 10^{6}

**Example:
Input:**

2

5

1 2 1 1 3

3

1 1 3

1

0

There are 2 test cases

a sub-sequence 1 2 3 exist

no such sub-sequence exist

Author: Shubham Joshi 1

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

preparecodinginterview_dot_com | 190 |

__murugan__ | 173 |

manvimahajan20 | 140 |

xiaoyan_yunche | 139 |

ShameekAgarwal | 116 |

preparecodinginterview_dot_com | 190 |

__murugan__ | 173 |

manvimahajan20 | 166 |

SoumyaKaushik | 146 |

arpit_anshuman | 140 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4567 |

Login to report an issue on this page.