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.

bhatabhi554 | 317 |

hardikJain5 | 306 |

CodeBuddy | 293 |

Akkki111 | 233 |

clone | 230 |

KshatriyaYash | 1932 |

nikhil_sojan | 1374 |

lonecoder | 1236 |

mazumderrohit8 | 1176 |

RemoveTLE | 1144 |

blackshadows | 5327 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4605 |

Quandray | 4444 |

Login to report an issue on this page.