Close
Topic list
Find Pair Sum in Rotated and Sorted array
EASY
10 mins
Binary Search
Topics (Covered in this problem)
Problem solved
Skill meter
Binary Search
-
-
Other topics
Problem solved
Skill meter
Strings
-
-
Matrices (2D Arrays)
-
-
-
-
Sorting
-
-
Stacks & Queues
-
-
Trees
-
-
Graph
-
-
Dynamic Programming
-
-
Greedy
-
-
Tries
-
-
Arrays
-
-
SQL
-
-
Binary Search Trees
-
-
Heap
-
-
Bit Manipulation
-
-
Solve problems & track your progress
Checkout your overall progress in every topic here
Become
Sensei
in DSA topics
Open the topic and solve more problems associated with it to improve your skills
Check out the skill meter for every topic
See how many problems you are left with to solve for cracking any stage. Score more than zero to get your progress counted.

# Find Pair Sum in Rotated and Sorted array

Contributed by
Shivam
Easy
0/40
Avg time to solve 10 mins
Success Rate 90 %
Share

## Problem Statement

#### Alice and Bob always loved to play with arrays. Alice took a sorted array and rotated it clockwise for a certain number of times.

##### For example:
``````Alice took a sorted array = [4,6,8,10,11] and if she rotates it by 3, then the array becomes: [8, 10, 11, 4, 6].
``````

#### You are given an array of integers ARR and a number K. Your task is to find out whether there exists a pair in the array ARR with sum K or not. If there exists a pair then you can return TRUE else return FALSE;

Detailed explanation ( Input/output format, Notes, Constraints, Images )

#### Sample Input 1:

``````3
5 4
5 7 9 1 3
4 2
8 10 11 1
6 -7
-3 3 6 -5 -4 1
``````

#### Sample Output 1

``````YES
NO
YES
``````

#### Explanation For Sample Output 1:

``````For the first array [5,7,9,1,3] there exists a pair (1,3) whose sum is equal to 4.

For the second array, there exists no pair whose sum is equal to 2.

For the third array, there exists a pair (-3,-4) whose sum is equal to -7.
``````

#### Sample Input 2:

``````3
6 -10
3 4 5 6 1 2
2 0
10 -10
4 -20
5 6 7 1
``````

#### Sample Output 2:

``````NO
YES
NO
``````
Auto
Console